Skip to main content

HTML Encode/Decode – Free Online Tool

Free online HTML Encode/Decode tool to encode text to HTML entities or decode HTML entities back to text. Handle special characters like angle brackets, ampersands, and quotes for safe HTML display. All encoding and decoding happens locally in your browser.

Example Output

Named mode preserves readability while making the string safe for HTML.

Encode "<p>Café & 5 > 3</p>"
&lt;p&gt;Caf&eacute; &amp; 5 &gt; 3&lt;/p&gt;

What is HTML Encode/Decode?

HTML Encode/Decode converts text to and from HTML-safe entities. Decode uses the browser's native parser so the full HTML5 entity set is supported (named like &iexcl;, numeric like &#x2603;, ~2000 entries in total). Encode offers four modes from minimal (only the 5 mandatory chars) to maximal (every non-ASCII becomes a numeric entity).

Why use this tool?

  • Open-and-go: bookmark the page once and never look for an alternative
  • Instant results — no waiting on a server or upload progress bar
  • Touch-friendly UI, fine on phones for on-the-go edits
  • Works with very large inputs (multi-megabyte JSON, long regex patterns, big tables)
  • No telemetry on the tokens, payloads, or code you paste in

How to use

  1. Pick Encode or Decode
  2. For Encode, select a mode: Basic (5 chars), Named + special (recommended), All non-ASCII, or Numeric-only
  3. Paste text, click Process, copy the result
  4. Decoder handles the full HTML5 entity set (~2000 entities including &euro;, &hearts;, hex/decimal numeric forms)

Examples

Make user text safe for HTML

Encode "<script>alert(1)</script>" → "&lt;script&gt;alert(1)&lt;/script&gt;". Now safe to drop into innerHTML or a server-rendered template.

Decode email snippets

Email bodies often arrive with &nbsp;, &mdash;, &copy; etc. Paste them in, decoded version is the readable text.

Round-trip non-ASCII

Use Numeric mode to fully convert "Café 你好" into ASCII-safe entities for systems that choke on UTF-8.

Common use cases

  • Escaping user input before injecting into HTML (XSS prevention)
  • Decoding entities found in scraped pages or email bodies
  • Preparing strings for systems that strip non-ASCII (legacy email, SMS gateways)
  • Learning what each named entity actually represents

Troubleshooting

Decoded output looks identical to input.
The input contains no entities to decode. If you expected changes, double-check that & characters are followed by valid entity names.

Frequently Asked Questions

HTML entities are special codes that represent characters that have special meaning in HTML, such as <, >, &, and ". Encoding them ensures they display correctly in browsers.

Try these related tools

Explore more Developer Tools

Discover other free, privacy-first tools in Developer Tools.