ToolJutsu
All tools
Developer Tools

HTML Encoder & Decoder

Encode and decode HTML entities.

Direction

Encoding converts & < > " and ’ into HTML entities so text displays literally instead of being parsed as markup.

0 chars
0 chars
Processed on your device. We never see your files.

How to use HTML Encoder & Decoder

What this tool does

This tool converts text to and from HTML entities. Encode mode rewrites characters that have a special meaning in HTML — &, <, >, ", and ' — as entities such as &amp;, &lt;, and &gt;, so a browser displays them literally instead of treating them as markup. Decode mode does the reverse: it turns &amp;, &#233;, &#xE9;, and every other named or numeric entity back into the character it represents. An optional setting in Encode mode also converts every non-ASCII character — accented letters, currency symbols, emoji — into a numeric &#NNNN; entity, which is handy when a file or transport must stay strictly ASCII.

Why you might need it

The moment you put user-supplied or dynamic text into an HTML page, encoding matters. If someone’s name contains a <, or a comment includes the word AT&T, dropping that text into the page raw will either break the layout or, worse, let injected markup run. Encoding neutralises it. You also need it the other way around constantly: API responses, scraped pages, exported CSVs, and email bodies are full of &amp; and &#39; sequences that need to be turned back into readable text before you can use them. Doing it by hand is slow and error-prone — a single missed & produces wrong output.

How to use it

  1. Choose Encode or Decode with the segmented control at the top.
  2. Paste your text into the left-hand box.
  3. In Encode mode, optionally tick Also encode all non-ASCII characters if you need pure-ASCII output.
  4. Read the result in the right-hand box — it updates live as you type.
  5. Click Copy output to copy the result to your clipboard.

Use Load sample if you want a quick example to see the behaviour, and Clear to empty both boxes.

Common pitfalls

The most common mistake is encoding the same text twice. If you run already encoded text through Encode again, every & in &amp; becomes &amp;amp; and the output is wrong. Encode a value once, at the moment you insert it into HTML. Another trap is assuming you only need to escape < and >. Inside an attribute value, an unescaped " or ' can terminate the attribute early — that is why this tool escapes all five reserved characters by default.

When decoding, remember that a malformed entity is left as-is. A stray & that is not part of a real entity stays a literal &, which matches how browsers behave. If your output still shows &amp;, the input was probably double-encoded at the source.

Tips and advanced use

For data that must travel through an ASCII-only channel — some legacy email systems, certain config formats, or strict XML pipelines — turn on the non-ASCII option so accented and symbol characters become numeric entities that survive the trip. The decoder accepts decimal (&#233;) and hexadecimal (&#xE9;) numeric forms as well as named entities, so you can paste output from almost any source and get clean text back.

Because everything runs locally in your browser, it is perfectly safe to encode or decode text that contains internal identifiers, tokens, or customer content — none of it leaves your device. Note that HTML encoding is about display correctness, not security on its own: it stops text from being parsed as markup, but it is not encryption and should be paired with proper context-aware escaping wherever untrusted input is used.

Frequently asked questions

Is my text sent to a server when I encode or decode it?
No. All encoding and decoding happens inside your browser using JavaScript. Nothing you paste is uploaded, logged, or stored — you can confirm this in your browser's Network tab.
Which characters get encoded?
By default the five characters that are special in HTML are encoded: the ampersand, less-than and greater-than signs, the double quote, and the apostrophe. Turn on the non-ASCII option to also convert every accented letter, symbol, and emoji into a numeric entity.
What is the difference between named and numeric entities?
Named entities use a readable label, such as &amp; for an ampersand or &copy; for a copyright sign. Numeric entities use a code point, such as &#169; or &#xA9;. The decoder understands all three forms; the encoder produces named entities for the five reserved characters and numeric entities for everything else.
Why should I encode the apostrophe and quote?
When you place text inside an HTML attribute, an unescaped quote can end the attribute early and break the page or open an injection hole. Encoding the double quote and apostrophe keeps attribute values intact no matter what the user typed.
Does decoding run any HTML or scripts?
No. The decoder parses the entities but only reads back the resulting text content. It never renders the markup, so a string containing a script tag is decoded to plain text and nothing is executed.

Related tools