Skip to content
ToolsOnDuty - free online tools
Developer Tools

HTML Entity Encoder / Decoder

Escape text to HTML entities or decode entities back to characters.

Free browser toolRuns in your browserNo sign-up
HTML entity workspace

Display reserved HTML characters as text—or decode them

Encode characters such as ampersands, angle brackets and quotes so browsers treat them as text, or decode named and numeric entities.

Encode entities

mode

0 B

input size

—

output size

Text or HTML entities

0 characters

Entity result

No output

Entity encoding changes text representation; it is not a complete HTML sanitizer for untrusted markup.

Private by design. Input is processed inside this browser tab and is not sent to ToolsOnDuty.

About the HTML Entity Encoder / Decoder

Certain characters such as <, >, & and quotes have special meaning in HTML. Escaping them as entities lets you show them as text instead of markup.

This tool encodes text into safe HTML entities, or decodes named and numeric entities back into the original characters.

It is handy for displaying code snippets and preventing reserved characters from being parsed as markup in an HTML text context. Entity encoding alone is not a universal HTML sanitizer. Everything runs in your browser.

Key features

  • Encode special characters to HTML entities
  • Decode named and numeric entities
  • Handles &, <, >, quotes and more
  • Copy, download or reuse the result
  • Clear warning that entity encoding is not full sanitization
  • Runs locally

How to use

  1. 1Paste text or entities, or load the realistic sample.
  2. 2Choose Encode entities or Decode entities.
  3. 3Copy, download or reuse the transformed result.

Examples

Encode HTML
Input: <div>Tom & Jerry</div>
Output: &lt;div&gt;Tom &amp; Jerry&lt;/div&gt;

Characters like <, > and & become entities so they show as text, not markup.

Frequently asked questions

Why should I escape HTML?
Escaping prevents reserved characters from being treated as markup in an HTML text context. Other contexts such as attributes, URLs, CSS and JavaScript need their own validation and encoding rules.
Does it decode numeric entities?
Yes. It decodes both named entities like &amp; and numeric ones like &#39; or &#x27;.
Is my text uploaded anywhere?
No. Encoding and decoding run entirely in your browser, so your text never leaves your device.

Open a related tool to prepare your files or refine the finished result.