DevMate
Back to Toolverse

Web

HTML Entity Encoder & Decoder

Escape five markup-sensitive characters or decode common and numeric references without rendering the result as HTML.

Local processing
Loading tool workspace...

About this tool

When to use it

Escape five markup-sensitive characters or decode common and numeric references without rendering the result as HTML.

How to use it

Choose Encode or Decode, paste the source, and run the action. Use output as input to reverse the operation on the current result. Inspect the destination context before inserting output into a page.

Guide updated . Examples checked against this implementation.

Worked examples

Escape a small markup fragment

Input

<b>A & B</b>

Expected output

&lt;b&gt;A &amp; B&lt;/b&gt;

Encoding makes angle brackets and the ampersand visible as text when interpreted in an appropriate HTML text context.

Errors and unsupported input

&copy; is not decoded

Only amp, lt, gt, quot, apos and numeric references are handled. Use a full HTML parser when the complete named-entity set is needed.

Continue this workflow

Questions

Frequently asked questions

Why does encoding twice produce &amp;lt;?

The second pass escapes the ampersand in the first result. Apply encoding once at the appropriate output boundary.