Markdown & HTML Tools

HTML Entity Encoder / Decoder

Encode special characters to HTML entities for safe embedding in HTML, or decode HTML entities back to readable characters. Handles named entities (&, <), numeric (<), and hex (<) forms.

Live preview available Browser-only No sign-up required
Input text
Options
Mode

All conversion happens in your browser; your text is never sent to a server

Features

  • Encode mode: converts &, <, >, ", ' to named HTML entities
  • Decode mode: converts all entity forms back to characters
  • Handles named, decimal numeric, and hex numeric entities
  • Toggle between encode and decode with one click
  • Copy result with one click
  • Browser-only

How to use it

  1. Paste your text or HTML into the input.
  2. Select Encode or Decode mode.
  3. Result appears instantly.
  4. Copy the output.

Use cases

  • Encoding user input before inserting into HTML to prevent XSS
  • Decoding HTML entities in scraped web content
  • Encoding code snippets for display inside <pre> blocks
  • Debugging entity encoding in HTML templates

Limitations

  • Only the most common HTML entities are encoded in the basic mode. Non-ASCII characters are not encoded unless 'full encoding' mode is selected.
Questions & answers

Frequently asked

What entities are encoded?

& → &amp;, < → &lt;, > → &gt;, " → &quot;, ' → &#39;. All other characters are left unchanged.