Search tools

HTML Entity Encoder & Decoder

Escape text so it shows safely in HTML, or turn entities like & and © back into characters.

HTML Entity Encoder & Decoder tool

Options

Processing runs in your browser.

HTML treats some characters as code. If you paste a < or & into a web page as-is, the browser may hide text or break the layout — or, with untrusted input, run something it shouldn’t. Entities are the escaped forms that display these characters as plain text.

Use it for

  • Showing code examples in blog posts and documentation.
  • CMS fields and email templates that mangle special characters.
  • Reading scraped or exported text full of &, ' and  .
  • Legacy systems that only accept ASCII.

How to use the HTML Entity Encoder & Decoder

  1. Paste text or HTML into the left box.
  2. Choose Encode to escape it or Decode to convert entities back.
  3. Pick how much to encode: only the five special characters, or non-ASCII characters too.
  4. Copy the result into your template, CMS or code.

Features

  • Minimal mode escapes only & < > " ' — exactly what’s needed to show text safely in HTML.
  • Named mode uses readable entities like &copy; and &mdash; where they exist.
  • Numeric modes encode non-ASCII or every character as &#…; for strict ASCII-only systems.
  • Decoder understands named, decimal (&#169;) and hex (&#xA9;) entities, including emoji.

Frequently asked questions

Which characters must be escaped in HTML?

In text content, & and < are essential; > is escaped for safety. Inside attribute values, also escape the quote character used to wrap the value. Minimal mode handles all five common cases.

Does escaping prevent XSS?

Escaping user text before putting it into HTML content or quoted attributes is a key defence against cross-site scripting. It isn’t enough inside script tags, event handlers or URLs, which need their own encoding.

Do I need entities for accented letters?

Not if your page is served as UTF-8, which is standard today. Entities for non-ASCII characters are only needed for systems that can’t handle UTF-8.

Written by