HTML Encoder
Paste HTML or text to escape the five special characters into entities, or switch the Mode to decode them back.
Runs in your browser. Nothing you enter is uploaded.
What it does
Encode mode replaces the five characters that HTML treats as markup: & becomes &, < becomes <, > becomes >, " becomes ", and ' becomes '. The result displays as literal text in a browser instead of being read as tags or attributes.
Decode mode does the reverse and understands the full range of named and numeric entities, such as , © or ’. Use it when a CMS, feed or API hands you escaped text that you need to read or edit. The Mode menu switches direction without clearing your input.
How to use it
- 1
Leave Mode on Encode, or choose Decode to reverse entities.
- 2
Paste your HTML or text into the Input box.
- 3
Read the converted text in the Output box as you type.
- 4
Click Copy above the Output box.
What you get
In Encode mode, your text with & < > " and ' replaced by entities and everything else untouched. In Decode mode, the text with all recognised entities turned back into characters.
When to use it
- Show code in blog posts
- Encode an HTML snippet so it appears as visible code inside a pre block instead of rendering as elements.
- Put text inside attributes
- Escape quotes before placing user text or a headline inside an alt or title attribute.
- Read escaped feed content
- Switch to Decode to turn <p> and &amp; from RSS or API output back into readable HTML.
Example
Input
<a href="/pricing">Tom's "Pro" plan & more</a>
Output
<a href="/pricing">Tom's "Pro" plan & more</a>
Pasted into a web page, the output shows the original tag as text.
Tips
- Encoding is not idempotent: running already-encoded text through Encode again turns & into &amp;. If you see double-escaped entities on a page, decode once.
- Accented letters and emoji are left as they are. Pages served as UTF-8 display them fine, so they do not need entities.
- For characters inside a URL (spaces, ? or &), use URL encoding instead; HTML entities and percent-encoding solve different problems.
- Encoding a snippet does not make untrusted input safe everywhere. Inside script tags, style tags or JavaScript strings, different escaping rules apply.
Questions
Which characters does HTML encoding need to change?
Only characters that could be read as markup: the ampersand, less-than and greater-than signs, and double and single quotes inside attributes. This encoder converts exactly those five and leaves all other characters alone.
Why does my page show &amp; instead of &?
The text was encoded twice, often once by you and once by the CMS. Set Mode to Decode and run it once to return to a single level of escaping.
Can the decoder handle and numeric entities like ’?
Yes. Decode mode uses the browser's own HTML parser, so named entities like and © and numeric ones in decimal or hex form are all converted.
What is the difference between HTML encoding and URL encoding?
HTML encoding makes characters safe to display inside a page (< becomes <). URL encoding makes characters safe inside a web address (a space becomes %20). Use the URL Encoder for query strings and links.
Related tools
Related tools
