HTML Encoder/Decoder
Encode special characters as HTML entities or decode entities back to text. Handles named and numeric entities, with an option for non-ASCII. Free online tool.
Encode and decode HTML entities
Some characters have special meanings in HTML. A < starts a tag and & starts an entity, so showing them as literal text requires writing them as entities such as < and &. The Encode tab converts text into this safe form, for example to display code samples on a web page. The Decode tab does the reverse, turning entities back into normal characters so you can read scraped content or feed data.
Named entities like ©, decimal ones like © and hexadecimal ones like © are all decoded.
Characters that matter most
With these five handled, text is safe in HTML content and in quoted attributes. Characters like © and é work fine as they are on UTF-8 pages, but you can enable Also encode non-ASCII characters to turn them into numeric entities. That helps when the output may pass through systems with encoding problems, such as old email software.
& &
< <
> >
" "
' 'Example: displaying code on a page
Without encoding, a browser would treat this snippet as a real link rather than showing the code. After encoding, it appears on the page exactly as written.
<a href="/search?q=1&lang=en">Tom & Jerry</a>
<a href="/search?q=1&lang=en">Tom & Jerry</a>Encoding as a defence against XSS
Cross-site scripting occurs when text from users is placed on a page and the browser runs it as code. Encoding user input on output stops <script> from being read as a tag. Modern frameworks such as React do this automatically, while in PHP you would use htmlspecialchars() with ENT_QUOTES.
The context matters, too. HTML encoding protects text inside elements and quoted attributes. It is not enough inside a JavaScript block, a CSS rule, or a URL such as href="javascript:...", each of which needs its own handling. Use this page for checking and one-off conversions, and rely on your framework's tools in production code.
Fixing double-encoded text
If you see something like &amp; or a literal <b> on a page, then the text has been encoded twice. This generally happens when text is encoded on saving and again on display. Decoding repeatedly here shows you the original, but the proper fix is to store raw text and encode only once when displaying it.
Frequently Asked Questions
What is the difference between HTML encoding and URL encoding?
HTML encoding makes text safe inside a page, turning & into &. URL encoding makes text safe inside an address, turning a space into %20. They are not interchangeable.
Do I need to encode every special character?
No. On a UTF-8 page, only &, <, > and quotes in attributes really need it.
What is ?
A non-breaking space. It looks like a normal space, but it does not collapse or allow a line break. Using it for layout is best avoided; CSS is a better choice.
Why does my decoded text still contain entities?
It was probably encoded more than once. Run the decoder again, then look into where the second encoding was introduced.