tools.now

HTML Entity Encoder / Decoder

Escape text so it can be shown inside an HTML page, or turn entities like &,   and ’ back into the characters they stand for.

Output

🔒 Runs in your browser. Your data is never uploaded.

How to use

  1. Choose Encode or Decode.
  2. Paste your text or HTML.
  3. Copy the result.

Only five characters need escaping

In a UTF-8 page, the characters that must be escaped are & < > and, inside attribute values, the quote marks. Accented letters, CJK text and emoji can be written directly. The non-ASCII option is for systems that only pass ASCII safely, such as some email templates.

Frequently asked questions

Why is the apostrophe encoded as &#39; and not &apos;?
&apos; is defined in XML and HTML5 but not in HTML 4, so some old clients show it literally. The numeric form &#39; works everywhere.
Does escaping prevent XSS?
It is the correct defence when inserting untrusted text into HTML content or a quoted attribute. It is not enough inside a script block, a URL or CSS, which have their own escaping rules.
Which entities can be decoded?
All numeric entities, decimal and hexadecimal, plus the common named ones such as &nbsp;, &copy;, &mdash; and accented letters. An unrecognised name is left as it is.

Related tools