HTML Entity Encoder & Decoder
Escape text for safe use in HTML, or turn HTML entities back into characters.
Runs in your browser — nothing is uploaded
Encoded
<p class="note">Fish & chips — £4.50 “to go”</p>
How to use HTML Entity Encoder & Decoder
- 1
Choose Encode or Decode.
- 2
When encoding, choose Only & < > " ' for standard escaping, or Also non-ASCII to encode accented letters and symbols too.
- 3
Type or paste your text into the box.
- 4
Select Copy to copy the result, or Swap to run it back the other way.
About this tool
Some characters have special meaning in HTML. A < starts a tag and an & starts an entity, so to show them as text they must be written as < and &. Quotes need escaping inside attribute values, as " and '. The default encode mode escapes exactly these five characters, which is what you need to show code samples on a web page or put user text into HTML safely.
Also non-ASCII converts every character outside basic ASCII into an entity: a named one such as é or € where HTML defines it, otherwise a numeric one such as 😀. Untick Use named entities to get only numeric entities. This is rarely needed on a UTF-8 page, but helps when HTML must pass through a system that mangles non-ASCII text, such as some email tools.
Decode turns entities back into characters. It handles decimal (©) and hexadecimal (©) numeric entities and all the named entities defined in HTML 4, which covers the ones used in practice, such as , ©, — and …. A named entity it does not recognise is left unchanged and counted, and the entity must end with a semicolon.
Escaping helps prevent cross-site scripting when you insert text into HTML, but it is not a complete defence on its own: text inside JavaScript, CSS or URLs needs different escaping. Everything runs in your browser.
Questions people ask
What does & mean in HTML?
It is the entity for the & character. If you see &amp; on a page, the text was escaped twice; decode it twice to get back to &.
Which characters must be escaped in HTML?
Always & and <. Also > for safety, and " or ' inside attribute values that use those quotes.
What is the difference between and a normal space?
is a non-breaking space: it looks like a space but stops the browser from wrapping the line at that point.
Should I use named or numeric entities?
Both work in every browser. Named entities are easier to read; numeric entities exist for every Unicode character.
Related tools
- URL Encode & DecodePercent-encode text for a URL, or decode an encoded URL back to text.
- Base64 Encode & DecodeEncode and decode Base64 text, or turn any file into a data URL.
- Find and ReplaceReplace every match in a block of text, with plain text or regex.
- JSON FormatterBeautify, minify and validate JSON, with errors pinpointed to the line.
- Hash GeneratorCalculate MD5 and SHA hashes of text or a file, and check a checksum.
- JWT DecoderPaste a JWT to read its header, payload and expiry time.