HTML Entities Explained: When and Why to Escape Characters
Seeing odd codes like the ones for less-than and ampersand in source code is normal. This guide explains what HTML entities are and when escaping matters.
What is the HTML Encoder & Decoder?
In HTML, characters like angle brackets and ampersands mark up the page rather than displaying as text, so showing them literally requires entities such as the ones for less-than and ampersand. This tool escapes the five common characters, and reverses the process for decoding. It works on short snippets of text and markup; it does not parse a full document, validate HTML, or sanitise unsafe content, so it is a formatting aid, not a security filter.
How to use it
- Type or paste the text or snippet.
- Choose Encode or Decode.
- Press the button and read the converted text.
Worked example
Encoding '<b>Tom & Jerry</b>' gives <b>Tom & Jerry</b>.
Why does my text show as code instead of a tag?
Because the angle brackets were escaped into entities, the browser shows them as text instead of treating them as markup. That is exactly what escaping is for.
Frequently asked questions
Which characters get escaped?
Ampersand, less-than, greater-than, double quote and single quote. Those are the characters most likely to be read as markup instead of text.
Does encoding make untrusted HTML safe?
Not on its own. Encoding helps display text literally, but deciding what content is safe to publish needs proper handling in your application, not just this converter.