XSS Payload Tester — Test Your Website for Cross-Site Scripting (XSS)

CodexFuse Team · 2026-10-14T06:55:39.272Z · 6 min read min read

Test your own website for cross-site scripting with a free XSS payload tester. Learn payload types, step-by-step testing, and how to fix XSS.

A comment box looks innocent. A visitor types a few characters, submits the form, and the page shows the comment back. Nothing seems wrong. Then the site owner opens the page and finds that the comment is not just text anymore: it is running code in every visitor's browser. That is cross-site scripting, usually called XSS, and it is one of the oldest tricks on the web because it still works.

XSS happens when a site takes input from a visitor and shows it back on a page without treating it as untrusted data. If the input contains markup or script, the browser cannot tell the difference between the site's own code and the visitor's code, so it runs both. The attacker does not need your password. They only need a form that echoes input back without escaping it.

What Is Cross-Site Scripting (XSS)?

Cross-site scripting is an attack where untrusted input is reflected or stored by a website and then executed as code in another visitor's browser. The malicious input travels through the site, so the victim's browser treats it as content from a trusted source.

There are three common shapes: reflected XSS, which comes back immediately through a search box or error message; stored XSS, which is saved in a comment or profile field and runs for later visitors; and DOM-based XSS, where page script inserts input into the document without proper handling.

How to Test Your Own Site for XSS

Test only sites you own or sites you have explicit permission to test. Set up a staging copy, try inputs in one field at a time, and record exactly what you entered and what the page showed back.

  1. Confirm you own the site or hold written permission to test it.
  2. Work on a staging copy, never on the live site your visitors use.
  3. Pick one input field and enter a unique marker string.
  4. Note where the marker appears in the page and whether it is escaped.
  5. Try a markup probe in the same field and observe how the page handles it.
  6. Record the field, the input, and the exact page behavior.

An XSS payload tester supplies test inputs in four categories, a custom-payload box, and an encoder for testing different contexts. Record each result yourself as you go: A tester shows whether input is reflected or escaped in a given field. It does not certify a site as secure, and a clean result on one field says nothing about the next field. We also published a full walkthrough of GDPR Compliance Checker — worth a read.

Fictional example: a bakery owner named Maya runs her own small shop site and wants to check its search box. On a staging copy, she searches for a unique marker string and sees it echoed in a “results for” line. She then tries a markup probe in the same box and finds the page displays it as plain text. She records the result, moves on to the comment form, and repeats the process field by field.

What Do Different Payloads Actually Reveal?

Different payloads reveal different weaknesses: a markup probe shows whether the page escapes angle brackets, an attribute probe shows whether quoted values break out, and a script-context probe shows whether input escapes existing code. Test each context separately, because a field that handles one probe may still fail another.

One widely used probe is a short script tag that triggers an alert, such as <script>alert(1)</script>. Used only on your own site or with explicit permission, it answers a narrow question: does this field let markup through unescaped? An alert proves the input was executed in that context. No alert does not prove the field is solid, because another context or encoding may still let something through.

How to Fix XSS Once You Find It

Fix XSS by treating all user input as untrusted data: encode output for the exact context where it appears, validate input on the server, and use a Content Security Policy to limit what the page is allowed to run.

Output encoding is the core fix. Text placed inside page HTML needs HTML encoding. Text inside an attribute needs attribute encoding. Text inside a script block needs script-context encoding. Using the wrong encoding for the context leaves the flaw open even when the code looks careful. If you want to go deeper, check out our guide to How to Check Website Traffic.

  • Encode output for the context it lands in: HTML, attribute, script, or URL
  • Validate input on the server, never only in the browser
  • Add a Content Security Policy that restricts script sources
  • Retest every fixed field on staging before deploying the change

After changing the code, repeat the same inputs in the same fields and confirm each one is now handled. If your site also takes database-driven input, pair this work with the SQL injection tester guide, which covers the parallel problem of untrusted input reaching a database.

Permission matters: testing a site you do not own, or testing without explicit permission, can be unlawful and can harm other people. Keep every test on your own staging copy, or on a system whose owner has agreed in writing.

What a Testing Checklist Should Cover

A testing checklist should cover every input that reaches a page: forms, search boxes, comments, profiles, URL parameters, error messages, and any field whose contents are shown to another user.

Do not forget the flows around the form. Password reset pages, contact confirmations, and preview screens all echo input, and each one is a separate place to check. The password entropy guide covers weak credentials, and the small business cybersecurity guide covers the wider defense plan. Run each field through the XSS payload tester and log the result before moving on.

Security flaws should not be your side job

Testing, patching, and retesting take hours that a business owner never gets back. CodexFuse runs your website, security updates, and IT on one fully managed platform paid for with credits, so the upkeep stops falling on you. For the full rundown, see Move a Website.

Get Started with CodexFuse

What Each Payload Category Tests

The XSS payload tester ships four payload categories, each probing a different weakness. Pick the category that matches the context you are testing — a field that blocks one category may still fall to another.

CategoryExample payloadWhat a hit means
Basic<script>alert('XSS')</script>Markup reaches the page unescaped — the field reflects raw HTML
Event Handlers" onmouseover="alert('XSS')You can break out of an HTML attribute and inject your own
Filter Bypass<ScRiPt>alert(1)</ScRiPt>A naive case-sensitive filter let the payload through
DOM-Based#<img src=x onerror=alert(1)>Client-side script passes input to a dangerous sink without sanitising it

The encoder tab converts any payload into three encodings for context testing: HTML entities (<script>alert(1)</script> becomes &lt;script&gt;alert(1)&lt;/script&gt;), URL encoding (<script>alert(1)</script> becomes %3Cscript%3Ealert%281%29%3C%2Fscript%3E), and Unicode escapes. If the application decodes the input before reflecting it, the encoded form can still execute — which is exactly what the encoder lets you verify.

Frequently Asked Questions

What is the difference between reflected and stored XSS?

Reflected XSS comes back immediately in the response. Stored XSS is saved on the site, such as in a comment, and runs for every visitor who later views that page.

Can I test a site I do not own if I mean no harm?

No. Testing without permission can be unlawful and can harm others even when your intent is good. Only test sites you own or systems whose owner has given explicit permission.

Does a clean test result mean my site is free of XSS?

No. A clean result covers one input in one field in one context. Other fields, contexts, and encodings may behave differently, so test every field separately. Find hundreds more practical how-tos on our blog.

Why does encoding need to match the context?

Because each context has its own rules for what counts as code. HTML encoding stops markup in page text but does not protect a value inside a script block.

Is a Content Security Policy enough on its own?

No. A Content Security Policy limits what the page may run and can reduce the damage, but it does not remove the flaw. Encode output, validate input, and treat the policy as an extra layer.

How do I test my site for XSS vulnerabilities?

Only test a site for XSS vulnerabilities you own or have written permission to test, and work on a staging copy. Probe one input field at a time: first a unique marker string to see where input lands, then a markup probe, then category payloads from the tester matched to each context (HTML, attribute, script, DOM). Record the field, the input, and the exact page behavior for every probe.

What does the payload encoder in the tester do?

It converts a payload into HTML entities, URL encoding, or Unicode escapes so you can test whether the application decodes input before reflecting it. A filter that blocks <script> may still pass %3Cscript%3E if the app URL-decodes first — the encoder lets you check each context honestly instead of assuming the filter holds.

Confirm permission, test on staging, record each result, fix by context, and retest.

Featured on Twelve Tools Hunt for Tools Featured on LaunchBuff Launch Llama Tools Launch your MCP Top Web Development Companies in the US - OnToplist.com Designer Listings Listed on SeeWhatNewAI Featured on SubmitMySaas Featured on AI Agents Directory Product Wing SaaS Wheel Featured on Stremit Featured on Thank John We Are Founders SubmitMySaas ShinyLaunch SaaS Tools Dir Featured on SaasHunt Product List Dir Featured on ShowMeBestAI Listed on Best-AI.org Featured on SaaSCity Listed on LaunchPact CodexFuse Solution on goodSaaS Featured on IndieLaunch Featured on BestAIApps AI X Collection Featured on SemiLaunch Listed on AlterBase We Like Tools codexfuse.dev LaunchClash Featured on Next Launch