No recently used tools
No favorite tools yet

Free HTML Escape / Unescape Tool Online - Entity Encoder Decoder

17 uses

HTML Entity Reference

CharacterEntity NameEntity NumberDescription
<&lt;&#60;Less than, tag opening
>&gt;&#62;Greater than, tag closing
&&amp;&#38;Ampersand, entity start
"&quot;&#34;Double quote, attribute delimiter
'&apos;&#39;Single quote, attribute delimiter
 &nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright symbol
®&reg;&#174;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 (&lt;) and numeric (&#60;). 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

Q Should I escape when storing data or when displaying it?
A Best practice is to escape when displaying (output encoding). Store raw data for search and flexibility. Different output contexts (HTML, JSON, URL) need different encoding.
Q What is the difference between &nbsp; and a regular space?
A &nbsp; is a non-breaking space that won't be collapsed by browsers and won't cause a line break at that position. Multiple regular spaces are collapsed into one.
Q Do single quotes need to be escaped in HTML?
A It depends on context. In attribute values wrapped with single quotes, yes. Best practice: always escape both ' and " (using &#39; and &quot;) for safety in all contexts.
Q Why do modern frameworks auto-escape HTML?
A Frameworks like React, Vue, and Angular auto-escape interpolated content to prevent XSS by default. You must use special methods (v-html, dangerouslySetInnerHTML) to insert raw HTML.
Q Does JSON need HTML escaping?
A JSON has its own escape rules. But if JSON content will be embedded in an HTML page or rendered as HTML, you still need HTML escaping for that output context.
Q What is the difference between HTML encoding and URL encoding?
A HTML encoding (or escaping) converts special characters like <, >, &, ", ' into HTML entities (e.g., &lt;, &gt;) to prevent browsers from interpreting them as code. It's crucial for XSS prevention when displaying user-generated content in web pages. URL encoding, conversely, transforms unsafe characters (e.g., spaces, &, =, /) into percent-encoded sequences (e.g., %20, %26) so they can be safely transmitted within a URL path or query string. They serve distinct purposes for different web contexts.
Q How do I display actual HTML tags or code snippets safely within a web page?
A To display literal HTML tags or programming code snippets within an HTML page without the browser interpreting them, you must HTML escape the content. This converts characters like `<`, `>`, `&`, and quotes into their respective HTML entities (e.g., `&lt;`, `&gt;`, `&amp;`). When these entities are placed within elements like `<pre>` or `<code>`, the browser renders them as the original characters, ensuring the code displays correctly and prevents accidental execution.
Q Why am I seeing HTML entities like `&amp;` or `&lt;` instead of the actual characters on my webpage?
A This often happens when text has been HTML-escaped multiple times, or when data is retrieved from a database that didn't properly decode previously escaped content. Your browser is then displaying the *literal* entities instead of rendering them as characters. Using an HTML unescape tool can convert these `&amp;` and `&lt;` back into `&` and `<` respectively, ensuring your content displays correctly and as intended without broken characters.
Q My database content shows HTML entities like `&amp;` or `&lt;`, how do I decode them for display on my website?
A 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 `&amp;` back to `&` and `&lt;` to `<`, ensuring your special characters and original formatting appear as intended, rather than as raw entity codes.
Q How can I quickly HTML escape or unescape a list of items from a spreadsheet or text file?
A 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 to Use

Related Tools