Developer Tools
HTML Entity Encoder / Decoder
Escape <, >, & and quotes as HTML entities, or decode named and numeric entities (&, ©, 😀) back to text.
How to use
- 1Choose Encode or Decode.
- 2Paste your text or HTML and copy the result.
Frequently asked questions
Which characters must be escaped in HTML?
& and < always; > for safety; and " or ' inside attribute values. Everything else can be written as-is in UTF-8 pages.
What does 'Encode all non-ASCII' do?
Also turns characters like é or emoji into numeric entities (é), useful for systems that aren't UTF-8 safe.
Does escaping prevent XSS?
Escaping text inserted into HTML is one key defense, but attributes, URLs and scripts need context-specific handling too.
Worked example: HTML Entity Encoder / Decoder
Encode <a href="x">Tom & 'Jerry'</a> and you get <a href="x">Tom & 'Jerry'</a> — every angle bracket, ampersand and quote (both double and single) is escaped, which is deliberately more aggressive than the HTML spec strictly requires (only & and < are mandatory), because escaping quotes too makes the output safe to drop straight into an HTML attribute value as well as into text content. Decoding <p> © © 😀 &bogus; shows the three entity forms side by side: a named entity (© → ©), a decimal numeric entity (© → the same ©), a hex numeric entity (😀 → 😀), and critically, &bogus; is left untouched exactly as written — the decoder only replaces entities it actually recognizes.
What "encode all non-ASCII" is actually for
By default, only the handful of characters with real HTML meaning (< > & " ') get escaped — é and 😀 pass through unchanged because modern pages are UTF-8 and render them natively. Toggling "encode all non-ASCII" instead converts every character above code point 126 into a numeric or named entity (é → é, 😀 → 😀), which matters specifically for systems that aren't reliably UTF-8-safe — older email templating systems, some legacy CMS import pipelines, or XML contexts with a declared non-UTF-8 encoding — where a raw multi-byte character can get mangled in transit but a plain-ASCII entity reference always survives.
Why escaping HTML text doesn't fully solve XSS
Escaping solves exactly one injection context: untrusted text being inserted as HTML content between tags. It does nothing to protect an attribute value if you're building attrs as unescaped-but-unquoted HTML, nothing to protect a value inserted inside a <script> block or an onclick= handler, and nothing to protect a URL inserted into an href. Each of those needs its own escaping rules (attribute escaping, JavaScript string escaping, URL encoding) — treating HTML entity escaping as a universal XSS fix is a common and genuinely dangerous mistake.
The non-ASCII switch disappears when I am decoding
Mode opens on encode. Encode all non-ASCII starts off, and that switch is hidden as soon as I pick decode. With it off, the ordinary pass still turns angle brackets, ampersands, and quotes into entities. The sample with Tom and Jerry shows the ampersand as an amp entity and the apostrophe as a numeric entity. With the switch on, any character past basic ASCII becomes a named entity when one exists, and a numeric entity when it does not. Decode does not offer that switch, because there is nothing left to decide. I stay on encode when I want the extra pass.
Related tools
- String Escape / Unescape
Escape or unescape strings for JavaScript, JSON, HTML, XML, SQL, CSV and regular expressions — quotes, backslashes and newlines handled.
- HTML Checker (Tags, Accessibility, SEO Basics)
Check HTML for unclosed or mismatched tags, duplicate IDs, images without alt text, missing lang/title/viewport and other common mistakes.
- Base64 Encode / Decode
Encode text to Base64 or decode Base64 back to text, with full UTF-8 support and a URL-safe option.
- URL Encode / Decode
Percent-encode text for URLs and query strings, or decode %20-style encoded URLs back into readable text.
- Accented Letters & Special Characters
Copy accented letters (é, ñ, ü, ç) and special symbols, with their HTML codes, Unicode values and Windows Alt codes.
- Caesar Cipher, ROT13 & Vigenère
Encrypt and decrypt with the Caesar shift, ROT13 or the Vigenère cipher — including a brute-force view of all 25 Caesar shifts.