Skip to content
🔣

HTML Entity Converter

Encode or decode HTML entities like & < > ".

Runs in your browser

Updated

Two buttons, two textareas

You paste text into the heInput box, press Encode or Decode, and the transformed copy appears in the read-only heOutput area below, with a Copy button that reads Copied! briefly after it writes to the clipboard. Nothing converts while you type; the buttons are the only triggers, and your original input is left untouched.

Exactly five characters get encoded

Encode runs a fixed chain of replacements: ampersand to & first, then angle brackets to < and >, the double quote to " and the single quote to '. Handling the ampersand before the others is what stops the entities it just created from being escaped a second time.

A worked example

Type <div class="hero">Tom & Sons</div> and click Encode. The result reads &lt;div class=&quot;hero&quot;&gt;Tom &amp; Sons&lt;/div&gt;, with every quote and bracket replaced and everything else copied across as it was. Feeding that line back through Decode restores it character for character.

What Decode knows

The reverse pass knows six named forms (amp, lt, gt, quot, apos, nbsp) and every numeric reference, decimal or hexadecimal, in any letter case. Unknown names are left exactly as written.

Where it stops

  • Named entities outside the six, such as the copyright sign or em dash, pass through Decode unchanged.
  • References without a trailing semicolon are left alone, because the pattern requires the closing semicolon.
  • Decoding is a single pass, so a doubly escaped marker such as &lt; becomes < rather than a raw bracket.
  • Only the six common named entities are built in; the full HTML name table is not included.

Questions people ask

Why did my named entity survive decoding?

Decode recognises six common names plus numeric references; anything else, including rarer named entities, is treated as ordinary text.

Is encoding quotes necessary?

Inside double-quoted attributes it keeps markup intact, and this page escapes both quote styles in one pass.

URL Encoder Decoder, Text Escape Unescape and HTML Beautifier pick up where this converter's fixed table ends.