Encode a markup fragment
{
"mode": "encode",
"value": "<div>"
}
{
"result": "<div>",
"direction": "Encoded HTML"
}
Communication
Encode HTML-sensitive characters as entities or decode entity references back into readable text.
Published Last reviewed
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.
Workspace
Set the source and target fields below, then reverse their values when useful.
This workspace updates as you edit.
Choose the values that apply, then convert html entities.
Replace reserved HTML characters with named/numeric entities and reverse safely.
Encode mode replaces & with &, < with <, > with >, double quotes with ", and apostrophes with '. 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.
{
"mode": "encode",
"value": "<div>"
}
{
"result": "<div>",
"direction": "Encoded HTML"
}
This tool does not store your inputs or results on UtilityPages.org.
Encode mode replaces ampersands, less-than and greater-than signs, double quotes, and apostrophes while leaving other characters unchanged.
Yes. The browser parser recognizes common named references and decimal or hexadecimal numeric character references.
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.
No. The interactive editor runs locally and displays output in a text area rather than rendering the supplied markup.