Communication

HTML Entity Encode / Decode

Live

Encode HTML-sensitive characters as entities or decode entity references back into readable text.

About HTML Entity Encode / Decode

The HTML Entity Encoder/Decoder provides two code-editor panes with live conversion. Encode ampersands, angle brackets, quotes, and apostrophes before displaying literal markup in HTML, or decode named and numeric entity references for inspection. Swap panes to reverse a result, load practical examples, and copy the output without rendering supplied markup.

Set up HTML Entity Encode / Decode

Workspace

Conversion flow

Set the source and target fields below, then reverse their values when useful.

This workspace updates as you edit.

Choose which calculation or conversion direction you need.

Enter the value you want translated, converted, or used in the selected calculation mode.

HTML Entity Encode / Decode: converted value

Choose the values that apply, then convert html entities.

Conversion method

Replace reserved HTML characters with named/numeric entities and reverse safely.

How it works

Encode mode replaces & with &amp;, < with &lt;, > with &gt;, double quotes with &quot;, and apostrophes with &#39;. Decode mode uses the browser's HTML entity parser to reverse recognized named and numeric references. Encoding text is not the same as sanitizing an entire document or making untrusted content safe for every HTML, URL, JavaScript, or CSS context.

Examples

Encode a markup fragment

Example input
{
    "mode": "encode",
    "value": "<div>"
}
Expected result
{
    "result": "&lt;div&gt;",
    "direction": "Encoded HTML"
}

Privacy

This tool does not store your inputs or results on UtilityPages.org.

Frequently asked questions

Which characters are encoded?

Encode mode replaces ampersands, less-than and greater-than signs, double quotes, and apostrophes while leaving other characters unchanged.

Can decode mode handle numeric entities?

Yes. The browser parser recognizes common named references and decimal or hexadecimal numeric character references.

Does encoding sanitize untrusted HTML?

No. Entity encoding is context-specific output handling, not a complete sanitizer. Use a trusted sanitization library and the correct encoding for the destination context.

Is the entered text uploaded or executed?

No. The interactive editor runs locally and displays output in a text area rather than rendering the supplied markup.