Home›Tools›HTML Entity Encoder / Decoder

HTML Entity Encoder / Decoder

Turn raw text like <script> into safe HTML entities like &lt;script&gt;, or read entities back into plain text when pasting snippets into templates, CMS fields, or documentation.

Raw text. The five HTML-sensitive characters become named entities.

How to use this tool

  1. Choose Encode to turn raw text into entities, or Decode to turn entities back into text.
  2. Type or paste the content into the input field; the output updates as you type.
  3. Use Copy output to copy the result into a template, CMS field, or documentation page.

Common HTML entities

CharacterNamed entityNumeric entity
&&amp;&#38;
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&apos;&#39;

Encoding is context, not a security guarantee

Encoding the five HTML-sensitive characters is appropriate when showing text inside an HTML document, such as a code sample or a CMS field that renders HTML. It is not a replacement for context-aware escaping in attributes, JavaScript, URLs, or SQL. Decoding works for numeric entities and a broad set of common named entities; unknown names are left untouched.

Frequently asked questions

It converts the five characters that can change HTML markup: ampersand, less-than, greater-than, double quote, and single quote. Other characters are left as they are.

All decimal and hexadecimal numeric entities, plus a wide range of common named entities such as amp, lt, gt, quot, nbsp, copy, mdash, and euro. Unknown named entities are preserved as written.

No. Entity encoding is one tool for HTML text contexts. Safe output also depends on where the value is used, such as attributes, URLs, or scripts, and often requires server-side validation and escaping.

No. Line breaks are preserved, and non-breaking spaces only change when you decode the nbsp entity.

No. Encoding and decoding run locally in your browser, and nothing is stored.

More in Text & Writing Counting, Markdown, and HTML entities.