How to encode or decode HTML entities
- Choose Encode to turn special characters into entities, or Decode to turn entities back into plain text.
- Paste your text or HTML into the top box. In Encode mode you can also tick Encode all non-ASCII to convert accented and symbol characters to numeric entities.
- The result updates as you type. Click Copy to grab it.
Why encode angle brackets and ampersands?
When you want to show code on a web page, the characters that make up the markup have to be escaped, or the browser will try to run them. For example the tag <div> becomes <div>, which the browser prints as the literal text <div> instead of building a real element. The five characters that must be escaped are the ampersand &, the angle brackets < and >, the double quote and the apostrophe — they become &, <, >, " and '. Encoding also helps when preparing text for an HTML email or a template, where a stray & or bracket could break the layout.
Encode vs decode — which do I need?
Use Encode when you have raw text or a code snippet and need a version that is safe to paste into an HTML page. Use Decode when you have already-escaped content — copied from a page source, an export or an API response — and want the original readable characters back. Decoding is also a quick way to fix mojibake, where entities such as & or numeric codes were left in the text by mistake, turning them back into the symbols they represent.
Is it safe? Does it run the HTML?
No — decoding never renders your input. Instead of dropping the text into a live element, this tool decodes named entities through a small built-in lookup map and resolves numeric entities like ' and ' with a regular expression. Because the HTML is never parsed or executed, pasting a snippet is completely safe. And like every Toolyard tool, it all happens in your browser — your text is never uploaded.
Frequently asked questions
What is the difference between encode and decode?
Encode turns special characters into HTML entities so they display as text; decode turns entities like < back into the original characters.
Why encode angle brackets?
Encoding the less-than and greater-than signs stops a browser from reading them as HTML tags, so a snippet such as a div is shown as text instead of being rendered.
Does this tool run or execute the HTML?
No. Decoding is done with a safe entity map and a numeric regex, not by rendering the input, so nothing in your text is ever executed as HTML.
Which characters are encoded?
The five special characters: ampersand, less-than, greater-than, double quote and apostrophe. You can also optionally encode every non-ASCII character as a numeric entity.
Is my text private?
Yes. Encoding and decoding run entirely in your browser. Your text is never uploaded and stays private on your device.