Free HTML Escape / Unescape Tool Online - Entity Encoder Decoder
328 usesHTML Entity Reference
| Character | Entity Name | Entity Number | Description |
|---|---|---|---|
| < | < | < | Less than, tag opening |
| > | > | > | Greater than, tag closing |
| & | & | & | Ampersand, entity start |
| " | " | " | Double quote, attribute delimiter |
| ' | ' | ' | Single quote, attribute delimiter |
|   | Non-breaking space | |
| © | © | © | Copyright symbol |
| ® | ® | ® | Registered trademark |
HTML Escaping Guide
What is HTML Escaping?
HTML escaping converts special characters like < > & into entity codes, preventing browsers from interpreting them as HTML markup.
XSS Prevention
Escaping user input is critical for preventing Cross-Site Scripting (XSS) attacks, where malicious scripts get injected into web pages.
Display Code Snippets
When showing HTML source code on a web page, you must escape the tags so they display as text instead of being rendered.
Data Safety
Escape user-generated content before rendering it in HTML. Modern frameworks like React and Vue do this automatically.
Entity Formats
HTML entities come in two forms: named (<) and numeric (<). Both produce the same result — named entities are more readable.
Must-Escape Characters
Five characters must always be escaped in HTML: < > & " ' — they have special meaning in HTML syntax.
Frequently Asked Questions
My database content shows HTML entities like `&` or `<`, how do I decode them for display on my website?
When content retrieved from a database displays HTML entities instead of actual characters, it means the text was HTML escaped before storage. To correctly render this on your webpage, you need to use an HTML unescape tool. This converts entities like `&` back to `&` and `<` to `<`, ensuring your special characters and original formatting appear as intended, rather than as raw entity codes.
How can I quickly HTML escape or unescape a list of items from a spreadsheet or text file?
Our online HTML escape tool is perfect for batch processing. Simply copy and paste your entire column or list of strings into the input area. The tool will instantly convert all special characters to HTML entities (escaping) or decode them back (unescaping). This saves significant time when preparing data from spreadsheets, CSVs, or text files for web display, ensuring XSS prevention or correct rendering.
How do I safely display copyright symbols or trademark characters in HTML using entities?
To ensure copyright `©`, trademark `™`, or registered `®` symbols display correctly and consistently across browsers and encodings, you should use HTML entities. Our HTML escape tool can convert these actual symbols into their corresponding entities (e.g., `©`, `™`, `®`). This prevents rendering issues and ensures your intellectual property marks are always visible as intended on your web pages.
Can HTML escaping protect against all XSS attacks?
Not by itself. Escaping handles output context, but XSS can also happen through JavaScript execution, CSS injection, or attribute-based attacks. You still need proper Content Security Policy headers and input validation. Think of escaping as one layer, not a silver bullet. Pair it with a CSP that blocks inline scripts for real protection.
Is there a way to escape just the angle brackets without touching other characters?
Our tool doesn't support selective escaping, and there's a good reason for that. Partial escaping leaves gaps attackers can exploit. Say you escape < and > but leave & alone. A user entering <script> would still render as a literal tag if your database double-encodes it. Run everything through the full escape once, then trust your output. You'll dodge weird edge cases.
What happens if I paste already-escaped HTML into the escape field?
The tool will escape it again, turning `&` into `&amp;`. That's usually not what you want. Always check your input starts as raw HTML characters, not entities. If you're unsure, paste a small sample first and glance at the output. This mistake trips up a lot of developers — especially when pulling text from a CMS that already escaped it once.
Why does my browser display raw HTML tags when I use <code>innerHTML</code> to insert text?
You're likely feeding the browser raw <code><</code> and <code>></code> characters through JavaScript. When you use <code>innerHTML</code>, the browser interprets them as markup, not text. Run your string through HTML escaping first — that converts <code><</code> to <code><</code> and <code>></code> to <code>></code>. Then assign the escaped version to <code>innerHTML</code>. This forces the browser to display tags as literal characters. Miss this step and you'll see broken layouts or, worse, an XSS hole you can't explain.
Do I need to escape HTML inside a <textarea> element?
Yes, you do. Many people think textareas are safe zones because they render text differently. The browser still parses HTML inside a textarea. Put raw < and > characters in there, and you'll break the page or open an XSS vector. Always escape any user content before injecting it into a textarea. Our tool handles this in seconds, turning < into < and > into > across thousands of lines.
Should I escape HTML before or after storing user input in my database?
Store raw input, escape at render time. That's the rule that saves you from double-encoding nightmares. If you escape before saving, you'll later unescape for editing, then re-escape for display — three places for bugs to creep in. Keep the database clean, then run everything through this tool right before it hits the browser. You'll avoid the mess where & becomes &amp; and your users see broken text. One exception: if you're building a static site, pre-escaping at build time works fine.
What's the difference between escaping HTML and URL encoding?
They solve completely different problems. HTML escaping converts characters like < and > into entities (<, >) so browsers render them as text, not markup. URL encoding turns characters into percent-encoded values (%3C, %3E) for safe transport in query strings and paths. Mixing them up breaks things in subtle ways. If you're building a link with user input, URL-encode the parameters. If you're displaying that same input on a page, HTML-escape it. Two separate steps, two separate tools—this one only handles HTML. A quick sanity check: if your URL shows %26 where & should be, that's encoding, not escaping. Use the right one for each layer and you'll avoid those confusing double-encoding bugs that eat hours.
How to Use
- Enter or paste HTML/text in the input box
- Click Escape to convert special characters to HTML entities
- Click Unescape to convert entities back to characters
- The HTML preview shows how the output renders in a browser
- Use Swap to quickly exchange input and output
- All processing runs locally in your browser — no data is transmitted