Skip to main content

HTML Entity Encoder / Decoder

Escape HTML special characters and convert entities back to text.

Runs in your browser

Converted markup will appear here.

About the HTML Entity Encoder / Decoder

Displaying code or user text inside a web page requires escaping. If angle brackets and ampersands are left raw, the browser interprets them as markup, which breaks the page and opens the door to script injection. This tool converts those characters into safe entities and back again.

It is equally useful in reverse, when a feed or database column has arrived full of entity references that you need to read as plain text.

How to use the HTML Entity Encoder / Decoder

  1. 1Choose Encode to escape text, or Decode to expand entities.
  2. 2Paste your content.
  3. 3Optionally escape quotes as well when the text will sit inside an attribute.
  4. 4Copy the converted output.

Features

  • Escapes ampersands, angle brackets and quotes
  • Decodes named and numeric entity references
  • Optional attribute-safe mode
  • Handles long documents without freezing
  • Copy and swap controls

Why people use it

  • Show code samples on a page without breaking the layout.
  • Reduce cross-site scripting risk when rendering user text.
  • Clean up double-escaped content from an old system.

Common use cases

  • Preparing an HTML snippet to display inside a tutorial.
  • Decoding entity-laden text exported from a legacy database.
  • Escaping a value that will be inserted into an attribute.

Privacy and your data

Encoding and decoding are performed in your browser only.

Frequently asked questions