consolelog.tools

HTML Entity Encoder / Decoder

Escape & unescape HTML entities — named or numeric, optional non-ASCII escaping, fuller decode table. Live.

About this ToolHow it works, benefits & use cases

Displaying code or user text inside an HTML page means escaping the characters the browser would otherwise treat as markup. This encoder always converts the five dangerous ones — "&", "<", ">", double-quote, and single-quote — into their entities so the content renders literally instead of becoming live tags. Two options extend that: "Use named entities" prefers readable names like &copy;, &euro;, and &mdash; from a curated table of common symbols, while "Escape non-ASCII" turns every code point above 127 into a numeric &#xHEX; reference for maximum portability. The decoder reverses all of it, resolving named entities plus decimal (&#123;) and hexadecimal (&#x7B;) numeric references — and it is astral-safe, so emoji come back whole. Both directions update live as you type, you can swap input and output, and the conversion is captured in a shareable link. It all runs locally in your browser.

How to Use

  1. 1Choose Encode or Decode with the toggle at the top.
  2. 2When encoding, open Options to turn on "Use named entities" and/or "Escape non-ASCII" depending on the output you want.
  3. 3Type or paste your text or HTML into the input box — the escaped or unescaped result updates live below.
  4. 4Click "Encode entities" or "Decode entities" to confirm the conversion.
  5. 5Copy or download the output, use "Swap input ↔ output" to reverse it, or share the link.

Key Benefits

  • Always escapes the five HTML-significant characters (& < > " ') for safe display
  • Optional named entities (&copy;, &euro;, &mdash; …) from a curated common-symbol table
  • Optional non-ASCII escaping turns every char above 127 into &#xHEX;
  • Decoder resolves named plus decimal (&#123;) and hex (&#x7B;) numeric references
  • Astral-safe decoding so emoji and other surrogate-pair characters survive intact
  • Live two-way conversion with a one-click swap button
  • Shareable URL captures the input and options for handoff

Common Use Cases

  • Safely rendering code snippets or user input inside an HTML page
  • Preventing markup injection when echoing text into a template
  • Producing portable, ASCII-only HTML by escaping accented or symbol characters
  • Decoding entity-encoded content scraped from a page or pulled from a feed
  • Inserting special symbols like © or — as proper named entities in source

Options

© → © instead of ©

Every char > 127 → &#x..;

0 characters · live

Enter input above to see the result.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools