Escape HTML special characters into entities — or decode entities back to plain text — so code samples display correctly and markup never breaks. Free, no signup, fully local.
What is the HTML Entity Encoder Decoder?
An HTML entity is a text replacement for a character that has special meaning in HTML, written as an ampersand, a name or number, and a semicolon — for example & for &, < for <, and > for >. This HTML entity encoder converts raw characters into their entity equivalents so they display literally instead of being parsed as markup, and decodes entities back into plain characters when you need the original text.
Encoding matters whenever you show code on a web page: an unescaped <div> inside a tutorial disappears into the DOM instead of displaying as text. It is also a first line of defense when rendering user input — escaping <, >, &, and quotes neutralizes the most basic script-injection attempts in reflected content.
The encoder handles the five critical XML/HTML characters plus common named entities (copyright, trademark, non-breaking space, curly quotes, em dash), and the decoder reverses them along with numeric forms like © and ©. Everything runs in your browser; paste snippets freely with no signup and no upload.
There is one more place entities shine: documentation and chat. When you paste a div tag into Slack, a ticket, or a Markdown file, renderers may swallow it as markup. Encoding the snippet first guarantees colleagues see exactly the code you meant, angle brackets and all — no screenshots required.
How to use the HTML Entity Encoder Decoder
- Choose Encode to turn characters into entities, or Decode to turn entities back into characters.
- Paste your HTML snippet, code sample, or entity-filled text into the box.
- Run the conversion — < > & ” ‘ become < > & " ' and named entities are handled both ways.
- Copy the result straight into your page, CMS, or documentation.
- Decoding also resolves numeric entities (© and © styles) automatically.
HTML Entity Encoder Decoder use cases
Displaying code in tutorials
Blog posts and docs that show HTML or JavaScript must escape every < and &. Encode the snippet here, then paste it inside your <pre><code> block so readers see the code instead of the browser executing it.
Sanitizing reflected user input
When echoing a username or search term back into a page, encoding <, >, and & stops the simplest cross-site scripting payloads from executing. It is not a complete security strategy, but it is the essential first step.
Fixing double-escaped text
Text that shows &amp; has been encoded twice. Run Decode to peel it back to a single encoding level, or twice to recover the original characters.
Preparing email templates
Some email clients mangle raw special characters. Encoding them as entities keeps templates rendering consistently across inboxes.
Tips
- Always encode user-supplied text before injecting it into HTML — it is the cheapest XSS protection there is.
- If you see &amp; in output, the text was encoded twice; decode once to fix it.
- Named entities like © are friendlier than ©, but numeric forms work everywhere — the decoder handles both.
- Encoding does not protect attribute contexts fully — always quote your attributes too.