Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsHTML Entity Encoder & DecoderHTML Escape & Unescape

HTML Escape & Unescape

dev

Escape text so it is safe inside HTML, or unescape escaped HTML again

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.

Five characters can break HTML or open it to script injection when user text is pasted in: the ampersand, the less-than and greater-than signs and both quote marks. Escaping writes them as &, <, >, " and ', which is enough for element text and quoted attribute values. Everything else, accents and emoji included, stays as it is.

Next:
  • URL Encoder / Decoder Percent-encode or decode text and URLs, and see every part of a link
  • String Escape & Unescape Escape text for a JSON, JavaScript, Java, Python, SQL or CSV string, or unescape it

How to use HTML Escape & Unescape

1

Paste or type your input.

2

Choose the options you need.

3

Press Ctrl+Enter, then copy or download.

How HTML Escape & Unescape works

An HTML entity, or character reference, is a way of writing a character with plain ASCII: a name such as ©, a decimal number such as ©, or a hex number such as ©. A browser shows all three as ©.

  • Only & < > " ' is what escaping user text needs. These five can end a tag, start one, or close an attribute value early, which is how text turns into markup and, at worst, into a script injection.
  • Plus non-ASCII also writes every accented letter, symbol and emoji as a reference, for a file or a system that cannot carry UTF-8, such as an old email template.
  • Everything encodes all but letters, digits and spaces, which some people use to hide an email address from simple scrapers.

Decoding follows the rules browsers use. All 2,125 names in the HTML standard are known, including the ones that stand for two characters. The 106 legacy names that work without a semicolon, such as &copy 2026, are decoded and flagged. &#0;, surrogates and numbers past U+10FFFF become the replacement character, and &#128; to &#159; are read as Windows-1252, so &#150; is an en dash, as in every browser. Text that is still encoded after one pass, such as &amp;lt;, is pointed out, with a button to decode again.

The rest of the article, and all 6 questions about HTML Entity Encoder & Decoder, are on the HTML Entity Encoder & Decoder page.

Frequently asked questions

Which characters must be escaped in HTML?

Five characters need escaping when text goes into HTML: the ampersand as &amp;, the less-than sign as &lt;, the greater-than sign as &gt;, the double quote as &quot; and the apostrophe as &#39;. Inside element text only & and < are strictly required, but escaping all five also keeps quoted attribute values safe.

Why does my text show &amp;lt; instead of <?

Text that shows &amp;lt; was encoded twice: the first pass turned < into &lt;, and a second pass turned that ampersand into &amp;. Decode it twice to get the original back. After each pass this tool counts the entities still present and offers one tap to run the decoder again.

Should I use named or numeric HTML entities?

Named entities such as &eacute; are easier to read, while numeric ones such as &#233; or &#xE9; work for every Unicode character, including emoji that have no name. A page saved as UTF-8 needs neither for accents; entities matter mainly for the five special characters and for systems limited to ASCII.

Is the HTML entity for a non-breaking space &nbsp;?

Yes, &nbsp; is the non-breaking space, U+00A0, also written &#160; or &#xA0;. A browser never breaks a line at it and never collapses several of them into one, unlike ordinary spaces. Overusing it for layout makes text hard to reflow on phones, so CSS margins are usually the better tool.

Sources

  • WHATWG HTML Living Standard, 13.5 Named character referencesThe 2,125 entity names the decoder knows, from entities.json
  • WHATWG HTML Living Standard, 13.2.5.72 Character reference stateMissing semicolons, &#0;, surrogates and the Windows-1252 rule for &#128;-&#159;
  • W3C HTML 4.01, 24 Character entity referencesThe 252 names the encoder writes

Last verified 16 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about HTML Entity Encoder & Decoder and anybody who knows can answer. No account needed.

More ways to use HTML Entity Encoder & Decoder

  • HTML Entity Encoder & DecoderEncode &, <, > and quotes as HTML entities, or decode every named and numeric entity
  • HTML Entity DecoderTurn &amp;, &lt;, &#8217; and every other HTML entity back into readable text

Same job, other tools: Query String Parser – Split a URL query string into a table of decoded parameters.

On the related tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON.

Related tools

All developer tools
Base64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneJSON to TypeScriptGenerate TypeScript interfaces or types from a JSON sampleCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolvedURL Encoder / DecoderPercent-encode or decode text and URLs, and see every part of a linkColor ConverterHEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast checkNumber Base ConverterBinary, octal, decimal, hex and any base to 36, exact at any size, with two's complement
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)