HTML Entity Encoder Decoder
Encode special characters as HTML entities or decode entities back to plain text, in named, decimal or hex form, as you type.
HTML Entity Encoder & Decoder
Turn < > & quotes and any Unicode character into safe HTML entities, or decode entities back to readable text. Named, decimal and hex output, live as you type.
Entity reference
Click an entity to insert it into the input box (the character when encoding, the entity code when decoding). Use the small copy button to copy the entity code.
Saved on this device 0
Tip: press Ctrl+Enter (Cmd+Enter on Mac) to copy the result. Decoding understands every named entity your browser knows, plus decimal and hex codes.
Found a Bug or Missing a Feature?
Report any problems or suggest new features you want. You can write in English, Urdu, Hindi, or any language! Our AI will analyze your feedback and upgrade the tool.
About This Tool
Encode special characters as HTML entities or decode entities back to plain text, in named, decimal or hex form, as you type.
An HTML entity is a short code that tells the browser to show a character instead of reading it as markup. The html entity encoder decoder above works in both directions: paste plain text to get safe entities such as < and &, or paste a block full of entities and read it as normal text again. You choose the style (named, decimal or hex) and how much to encode, and the result updates while you type.
The day “Salt & Pepper” grew an extra “amp;”
The most common reason people end up here is a page that prints a literal & where an ampersand should be. The cause is almost always double encoding. A product called Salt & Pepper is saved by the CMS as Salt & Pepper. The theme then treats that stored text as unsafe and encodes it again, producing Salt &amp; Pepper. The browser decodes one layer and shows the second one as plain text.
Paste the broken output into the box above, switch to Decode, and look at the result. If you still see entities after one pass, something upstream encoded twice. Decode a second time and you have the original. Knowing which layer to fix, the editor or the template, saves a lot of guessing.
Which characters actually need encoding
Less than most people think. In normal text content only two characters are dangerous: the ampersand, because it starts an entity, and the less-than sign, because it starts a tag. The greater-than sign is harmless on its own but is encoded by habit and by most libraries. Inside an attribute value, the quote character that wraps the value must be encoded, which is why " shows up so often.
The apostrophe has a small catch. ' is valid in HTML5, but it was never defined in HTML 4, so very old engines ignore it. The decimal form ' works everywhere, and it is what you get when you pick the decimal style above.
Everything else, from the copyright sign to the euro sign, is optional as long as your page is saved as UTF-8 and declares it with a meta charset tag. The “Reserved + all non-ASCII” option exists for the opposite situation: an ASCII-only pipeline, an old mail system or a config file that mangles accented letters.
Named, decimal or hex
Named entities such as © are the easiest to read, but only about two thousand characters have a name, and the emoji you pasted is not one of them. In named mode the tool falls back to a number for those. Decimal references like © work for every character. Hex references like © line up with Unicode charts, where the same sign is U+00A9, so they are handy when you are copying from a code point table.
Where entity bugs really hide
- Script and style blocks. Inside <script> and <style> the browser does not decode entities at all. Write < there and it stays as those literal characters.
- Textarea and title. These elements decode entities but never parse tags, so <b> displays as text and does not bold anything.
- XML and RSS feeds. XML predefines only five entities: amp, lt, gt, quot and apos. A feed that contains © fails to parse in strict readers. Use the numeric form © instead.
- Non-breaking spaces. looks like a space but is not collapsed or wrapped. It is a quick way to keep “10 kg” on one line, and a quiet cause of search-and-replace failures when it sneaks into copied text.
Three small jobs this page handles well
Showing code in a tutorial
If you write a post about HTML, the examples have to be encoded or the browser will run them instead of displaying them. Paste the snippet, keep “Only the 5 reserved characters” selected and copy the result into your editor’s HTML view. The same trick works for a JSON payload you are placing inside a page; run it through the JSON formatter and validator first so you know it is valid before you escape it.
Rescuing a messy export
Spreadsheet and database exports love to hand you text like Café Müller or ’. Load the file with the button above (plain text and HTML files up to 1 MB), decode it, and download the clean version.
Checking a template before it ships
Type a tricky string, such as a name with an apostrophe or a price with an ampersand, encode it, and then decode it again with the swap button. The round-trip check in the results panel tells you whether the text survived unchanged. When you are tidying a stylesheet afterwards, the CSS minifier is a natural next stop.
Encoding is not a security plan by itself
Escaping user text before it is written into HTML is one of the main defences against cross-site scripting, and that is why template engines do it for you by default. But the right escaping depends on where the text lands. HTML body, attribute, JavaScript string, URL and CSS each need different treatment, so a single pass through any encoder, this one included, will not make an unsafe design safe. Use this tool for one-off jobs and for understanding what your framework is doing, and let the framework’s auto-escaping handle live traffic.
Everything on this page runs inside your browser. The text you paste is never uploaded, and your recent conversions are kept only on your own device, where you can export or clear them at any time.
Frequently asked questions
What is the difference between an HTML entity and a character reference?
In everyday use they mean the same thing. Strictly, “entity” covers named codes like ©, while “character reference” also includes numeric forms like © and ©. The tool produces and reads all three.
Why does my page show & instead of an ampersand?
The text was encoded twice. Decode the output once with this html entity decoder, and if entities remain, a second layer is responsible. Fix the layer that encodes already-encoded text, usually the template or an extra escaping filter.
Do I need to encode accented letters and emoji?
Not when the page is served as UTF-8 and has a charset declaration. Encode them only for ASCII-only systems, or when you want the source file to stay pure ASCII.
Is ' safe to use?
It is valid in HTML5 and XML, but not in HTML 4. For the widest compatibility use the decimal form '.
Does this tool upload my text?
No. The conversion is done by JavaScript in your browser, and nothing leaves your device.
