HTML Escape/Unescape - Online Encode Special Characters
Escape HTML special characters to prevent XSS attacks, or unescape HTML entities back to original text. Essential for web developers. Runs locally.
UD5 Toolkit
Protect against Cross-Site Scripting (XSS) by converting special characters into safe HTML entities. Essential for web developers handling user-generated content.
<, >, &, ", and ' into their corresponding HTML entities (e.g., <, >). This prevents browsers from interpreting user input as executable HTML or JavaScript, which is the primary defense against Cross-Site Scripting (XSS) attacks. Without escaping, an attacker could inject malicious scripts that steal user data, hijack sessions, or deface websites.
&), < (less-than → <), > (greater-than → >), " (double quote → "), and ' (single quote → '). In attribute contexts, quotes are especially dangerous. For comprehensive protection, also consider escaping / (forward slash → /) to prevent breaking out of HTML comments or closing tags prematurely.
<script>alert('xss')</script>) into web pages. When this input is properly escaped to <script>alert('xss')</script>, the browser treats it as plain text rather than executable HTML. The escaped string displays literally on the page but does not execute. This simple transformation neutralizes the vast majority of reflected and stored XSS attack vectors.
&, <, >, ", '), which covers the majority of XSS attack surfaces. Full Entities goes further by escaping all non-ASCII and special characters (like /, `, =, parentheses, etc.) into their entity equivalents. Full mode is recommended when you need maximum security, such as when handling completely untrusted user input in sensitive contexts like HTML attributes or legacy systems.
<) are more compact for higher Unicode codepoints and are preferred by many developers for readability when dealing with hex values. Decimal entities (<) are sometimes preferred in XML contexts or when working with systems that expect decimal notation. For everyday HTML escaping, either works perfectly—choose based on your team's coding standards or the conventions of your codebase.
JSON.stringify() or proper JS escaping), CSS contexts, URL parameters (use URL encoding), and HTML attribute contexts without quotes. A robust security strategy combines escaping with Content Security Policy (CSP) headers, input validation, sanitization libraries like DOMPurify, and secure coding practices like avoiding innerHTML in favor of textContent.
document.createTextNode(str) or set element.textContent = str. For string-based escaping, a reliable function maps characters to entities: str.replace(/[&<>"']/g, char => entityMap[char]). Avoid using innerHTML with untrusted content. Libraries like DOMPurify provide additional sanitization. This tool's JavaScript implementation can be inspected in your browser's developer console for a production-ready escaping function.
htmlspecialchars(), Python's html.escape(), Java's StringEscapeUtils, etc.). Bookmark this page for quick access when you need to escape strings during development.
Escape HTML special characters to prevent XSS attacks, or unescape HTML entities back to original text. Essential for web developers. Runs locally.
Test regular expressions with Unicode property escapes like \p{Emoji}. See matches live. Modern regex power.
Check if your site has a visible and functional skip navigation link. Key for keyboard‑only users.
Enter any phrase and see it spelled letter by letter using the NATO phonetic alphabet. Copy ready for radio.
Test required, pattern, minlength etc. See validity states and custom error messages. Learn browser‑native validation.
Adopt a virtual pet rock. It sits there. Sometimes you can polish it or give it a name. The low‑maintenance pet you always wanted.
Create a slow, zooming and panning photo montage (Ken Burns effect) from your images. Export as WebM video. Canvas.
Test a regular expression against malicious inputs to detect catastrophic backtracking and ReDoS vulnerabilities. Educational.
Paste a URL or HTML to detect known vulnerable JavaScript library versions. Quick security audit. Client‑side only.
Encode or decode a string for use in a URL query parameter. See the raw and encoded versions. Dev tool.
Drop a PDF and extract any embedded JavaScript or form actions. Check for malicious code. Privacy‑friendly analysis.
Test SQL injection inputs on a mock database and see the resulting query. Learn how to prevent SQLi. No real data.
Paste a potential XSS vector and see if it executes in a sandboxed iframe. For security researchers and education.
Use the new Sanitizer API to safely insert raw HTML into the DOM. Blocks malicious tags. Experimental demo.
See how Trusted Types prevents unsafe HTML assignment. Test against injected scripts. Modern security practice.
Validate a DNSSEC chain by entering DS and RRSIG records. Verify that signatures match. Educational. Local algorithm.
Paste the Permissions‑Policy header and get a human‑readable table of allowed/blocked browser features. Understand how your site is restricted.
Test if a script or style will be allowed by a given CSP. Compute hash/nonce. Strengthen your site’s defense against XSS. Local.
Create a passkey and authenticate using the Web Authentication API. Supports platform authenticators (TouchID, FaceID). No server.
Check if a URL can be embedded in an iframe. Test your site’s defense against clickjacking. Browser‑based.
Fetch a site’s HSTS header and validate its syntax, max‑age, and subdomain flags. Ensure your site enforce HTTPS.
Paste a Content‑Security‑Policy header and get a human‑readable breakdown. See potential risks and suggestions.
Configure browser feature permissions (camera, microphone, geolocation) and generate the Permissions‑Policy HTTP header.
Encode latitude/longitude into a geohash string and decode a geohash back to coordinates with precision info. Local algorithm.
Convert integers into short, unique, YouTube‑style IDs (hashids) and decode them back. Customize salt and minimum length.
Encode any file into a Base64 string that you can copy, or decode a Base64 string back to a downloadable file. Pure frontend.
Convert your text into a string of emojis using a simple substitution cipher. Share secret messages that look fun. Decode them with the same tool. All local.
Convert plain text into HTML‑safe strings by escaping <, >, &, and quotes. Insert into code safely. Local copy.
Hide your email address from scrapers by encoding it using HTML entities and CSS tricks. Still clickable for real users. Local generator.
Build an iframe with different sandbox flags and see live which features are blocked. For secure embedding.