HTML Encoder and Decoder
The HTML Encoder and Decoder turns special characters such as < > & and quotes into HTML entities so text shows as text on a web page, and decodes entities like &, é and € back into normal characters. It runs as you type, in your browser.
The first choice is right for any page saved as UTF-8, which is almost every page today.
What is the HTML Encoder and Decoder?
The HTML Encoder and Decoder converts between plain text and HTML character references. Encoding replaces the five characters that have a meaning in HTML, the ampersand, less-than and greater-than signs and both quote marks, so code samples, user comments and attribute values display instead of breaking the page. You can also encode every non-English letter by name (é) or by number (é) for old systems and XML feeds. Decoding reads all 2,231 named references in the HTML standard plus decimal and hex numbers, exactly as a browser would. Web developers, bloggers pasting code, email template builders and anyone cleaning text copied from a CMS or database use it. Nothing leaves your browser.
Who it is for: Web developers, bloggers and technical writers showing code, email template builders, and people cleaning text full of & and ' from a database or CMS.
How to use the HTML Encoder and Decoder
- Choose Encode or Decode.
- Paste your text, HTML or encoded text.
- For encoding, choose whether to escape only the special characters or non-English letters too.
- Copy the result, or press Use result as input to reverse it.
Why use it
- Three encoding levelsEscape just the five special characters, or also every non-English letter by name or by number.
- Decodes like a browserAll named entities in the HTML standard are known, along with decimal and hex numbers, so the result matches what a page shows.
- Tells you what changedA count of encoded characters or decoded entities shows at a glance whether the text needed any work.
- PrivateCode, emails and customer data stay on your device. The tool works offline once the page has loaded.
At a glance
- What you put in
- Any text, HTML or text containing HTML entities, typed or pasted
- What you get
- Text with HTML entities (< & " ' and more), or decoded plain text
- Limits
- Encodes characters, not tags: it does not clean or sanitise HTML; no file upload
- Privacy
- Runs in your browser. Nothing you enter is uploaded or stored.
- Price
- Free for everyone. No subscriptions, no payments, no watermark.
- Works offline
- Yes, once the page has loaded
- Last checked
- by AK Shine
Worked example
<p class="note">Café & "crème"</p> (Encode, only the 5 special characters)
<p class="note">Café & "crème"</p>
The 9 special characters became entities and the accented letters stayed as they are, which is right for a UTF-8 page. With the "by name" choice, é and è would also become é and è.
When to use something else
- Encoding is not the same as sanitising. If you need to allow some HTML from users, such as bold and links, but block scripts, use a sanitiser library such as DOMPurify on your site instead.
- For text that goes inside a URL, use URL encoding (percent-encoding), not HTML entities. For text inside a JavaScript string, use JSON or JavaScript escaping.
Questions people ask
Which characters must be encoded in HTML?
Inside normal page text, & and < must be encoded, and > is usually encoded too. Inside an attribute value, also encode the quote that wraps it, " or '. Encoding all five everywhere is the simple, safe habit, and it is what the first option does.
Should I encode accented letters like é?
Not on a modern page. If the page is saved as UTF-8 and has <meta charset="utf-8">, é, ₹ and emoji can be typed as they are. Encode them by name or number only for systems that cannot handle UTF-8, such as some old email tools and XML feeds.
What is the difference between ' and '?
Both mean an apostrophe. ' is defined in HTML5 and XML but not in HTML 4, so some old email clients show it as text. ' works everywhere, which is why this tool uses it.
Why do I see &amp; in my text?
The text was encoded more than once. Each round turns the & of the previous entity into &. Decode it, check the result, and decode again until the entities are gone. Then fix the code that encodes twice.
Does HTML encoding stop XSS attacks?
Encoding user text before you put it into page text or a quoted attribute is the main defence against cross-site scripting there. It is not enough inside script blocks, style blocks or URLs, which need their own escaping.
What does mean?
It is a non-breaking space: it looks like a space but keeps the words on both sides on the same line. Decoding turns it into that character, which many editors show as a normal space.
Is the HTML Encoder and Decoder free?
Yes. It is free with no subscriptions and no limit on text length beyond your device's memory. Your text is never uploaded; all the work happens in your browser.