HTML Entity Encoder & Decoder
Convert characters like <, >, & and quotes to safe HTML entities, or turn entities back into readable text.
Three modes
Essential encodes the five characters that matter in HTML: < > & and both quote marks. Full also encodes every non-ASCII character. Numeric writes entities as numbers, for example & becomes &.
Why escape?
Displaying code or user text inside HTML requires escaping, otherwise the browser treats it as markup. Escaping is also a basic defence against cross-site scripting when text is shown on a page.
How to use it
- Choose the Mode.
- Paste text into Input.
- Press Encode or Decode and copy the output.
Encoding example
In Essential mode this input:
<b class="x">Tom & Jerry's</b>
becomes <b class="x">Tom & Jerry's</b>.
Common use cases
- Showing code samples inside a web page.
- Preparing text for an HTML email or attribute.
- Reading entity-heavy text copied from page source.
Exactly what each mode outputs
All three modes work one character at a time. Essential replaces &, <, >, " and ' with &, <, >, " and '. Full does the same and writes every character above code point 127 as a decimal numeric entity. Numeric converts every character, including letters and spaces. Verified on the text café — © 😀 <3 in Full mode:
café — © 😀 <3
Numeric mode on A&é gives A&é. Emoji and other characters outside the basic plane come out as one entity for the whole code point, not two surrogate halves. The encoder never writes named entities such as © or , only numeric ones.
How decoding behaves
Decoding hands your text to the browser's own HTML parser and returns the resulting text. That means it understands every named entity the browser knows (©, …, ), plus decimal and hexadecimal numeric entities. It also means any tags in the input are removed rather than preserved: decoding <b>x</b> & y returns x & y. A non-breaking space decodes to a real U+00A0 character, which looks like a normal space but is not one, a common cause of mysterious string comparison failures.
Because a parser is involved, only decode markup you trust. Treat anything copied from an unknown page as hostile text and do not paste it into decoders you do not control.
Mistakes to avoid
- Double encoding. Encoding text that is already escaped turns
&into&amp;, which then shows a literal ampersand-amp on the page. Encode once, at the point of output. - Wrong context. Entities protect text in HTML content and quoted attribute values. They do not make a string safe inside a
<script>block, a URL or a CSS value, each of which has its own escaping rules. - Apostrophes. The tool writes
', not', because the latter is not valid in HTML 4 and older email clients. - Not every character needs it. If the page is UTF-8, Essential mode is enough and the output stays readable.
Frequently asked questions
What is an HTML entity?
A text code such as &lt; that the browser shows as a character, so it is not treated as markup.
Does escaping prevent XSS?
It is an important part of it for text placed in HTML, but context matters, so follow your framework's escaping rules too.
Which mode should I use?
Essential for most cases; Full when the page might not be served as UTF-8.
Is my data uploaded?
No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.
Does it produce named entities like ©?
No. Full and Numeric modes write numeric entities such as ©. Decoding does understand named entities.
Why did decoding remove my tags?
Decoding uses the browser's HTML parser and returns only the text content, so tags are stripped. Encode the markup first if you want to keep it as text.