HTML Encoder
Escape text for safe HTML — encode &, <, >, quotes and non-ASCII.
The HTML Encoder escapes text so it displays literally inside HTML instead of being interpreted as markup. Ampersands, angle brackets and quotes become entities — <, &, " — that browsers render as plain characters.
Escaping is the difference between user input breaking a page and displaying safely: a comment containing <script> would execute without escaping, and raw ampersands can corrupt URLs and validation. This is why templating systems escape everything by default.
Two modes cover the use cases: the minimal mode escapes the five characters that matter in HTML contexts; the full mode additionally converts every non-ASCII character to a numeric entity, which helps when the target encoding is unknown. Processing happens locally.
How to use the HTML Encoder
- Paste the text or code snippet you want to display in HTML.
- Choose minimal or full encoding.
- Read the escaped output.
- Copy it into your HTML source.
- Render it to confirm it displays as literal text.
Frequently asked questions
Which characters must be escaped in HTML?
& < > " and ' (ampersand, less-than, greater-than, double and single quotes). The ampersand must be escaped first or it can corrupt the other entities.
When should I use full numeric encoding?
When your text contains non-ASCII characters (accents, emoji, symbols) and you want an ASCII-safe representation — useful for legacy systems or when the character encoding of the target is uncertain.
Is escaping the same as sanitizing HTML?
No — escaping makes untrusted text safe to display as text. Sanitizing (used for rich content) strips dangerous tags while allowing safe markup. If you need to allow formatting, use a sanitizer instead.
Related tools
View all developer tools →JSON Formatter & Validator
Format, minify and validate JSON instantly with clear error messages that point at the exact problem.
Dev ToolsJSON Validator
Check if your JSON is valid and find syntax errors with exact line and column.
Dev ToolsJSON Minifier
Compress JSON to its smallest valid form for storage and transport.
Dev ToolsJSON to CSV
Convert a JSON array of objects into a clean CSV file in one click.
Dev ToolsCSV to JSON
Convert CSV (from Excel or Google Sheets) into a JSON array of objects.
Dev ToolsBase64 Encoder
Encode text or files to Base64 — standard or URL-safe — in your browser.