In short: HTML entity encoding replaces characters with special meaning in HTML, such as <, >, & and quotes, with entities like < and & so they display as text instead of being parsed as markup.
About HTML Entity Encoder & Decoder
In HTML, a handful of characters have special meaning: < starts a tag, & starts an entity and quotes end attribute values. If you want to show those characters as text — in a code sample, a blog post or a template — they must be written as entities such as < and &. Escaping user-supplied text this way is also the basic defense against cross-site scripting.
Encoding converts the five critical characters (& < > " ') and can optionally turn every non-ASCII character into a numeric entity for systems that cannot handle UTF-8. Decoding uses the browser’s own HTML parser, so it understands all 2,000+ named entities, decimal and hex numeric forms, and the quirky cases browsers accept.
How to use HTML Entity Encoder & Decoder
- Paste text or HTML into the input box.
- Press Encode to escape special characters, or Decode to turn entities back into characters.
- Tick the non-ASCII option if the target system only accepts plain ASCII.
- Copy the output.
Examples
<b>bold</b> encodes to <b>bold</b>, which a browser displays as the literal tag instead of bold text.
Café — “open” decodes to Café — “open”.
Frequently asked questions
Is encoding enough to prevent XSS?
Escaping text placed in HTML element content and quoted attributes is essential, but contexts like inline JavaScript, CSS and URLs need their own encoding. Use your framework’s auto-escaping and a Content Security Policy as well.
What is the difference between &nbsp; and a space?
is a non-breaking space: browsers will not wrap a line there or collapse it with neighboring spaces.
Should I encode accented letters?
Not if your page is served as UTF-8, which is the modern default. Only encode them for legacy systems.
Does decoding run any scripts?
No. Decoding uses an inert textarea element, so tags in your input are never executed.
Updated November 2026 · Free, no signup · How we build and test tools