About the HTML Entity Encoder / Decoder
In HTML, characters such as <, > and & have special meaning. If you want to show them as text, for example when publishing code snippets in a blog post, they must be written as HTML entities like < and &. The HTML Entity Encoder / Decoder converts them automatically.
Encoding user-supplied content is also a key defense against cross-site scripting (XSS). Enable Encode all non-ASCII characters to convert emojis and international letters into numeric entities for systems that only support ASCII. Decode mode understands named entities (like © and ), decimal and hexadecimal numeric entities.
Examples: when you need HTML entities
Suppose you want to show this line of code in a blog post:
<p class="note">Tom & Jerry</p>
If you paste it as is, the browser treats it as a real paragraph and the tags disappear. Encoded, it looks like this in your HTML source:
<p class="note">Tom & Jerry</p>
and readers see the original code exactly.
Common entities worth remembering
<and>for < and >&for &"for a double quote inside attributes for a space that never breaks, for example between a number and its unit: 10 kg©for ©
Typical uses
Writing tutorials, showing code in documentation, putting special characters into email templates, and cleaning up text that arrives full of entities from a database or an RSS feed (decode mode turns ' back into an apostrophe).
How to use the HTML Entity Encoder / Decoder
- Choose Encode or Decode.
- Paste your HTML or entity-encoded text.
- Optionally encode all non-ASCII characters.
- Copy the output.
Frequently asked questions
Which characters must be escaped in HTML?
At minimum, & and < in text, plus quotes inside attribute values. This tool also escapes > and apostrophes for safety.
Does decoding run any scripts?
No. Decoding uses a textarea element, which never executes HTML or scripts.
What is ?
A non-breaking space, which prevents a line break between two words and is not collapsed like normal spaces.
