What is an HTML entity?
In HTML some characters have a job: < opens a tag, & announces an entity. To display them, you write them in a coded form that starts with & and ends with a semicolon. So < is written < and & is written &.
Any character can also be written with its Unicode number, in decimal or hexadecimal. Many have a name too, such as é for é or € for €.
Encoding
- Only < > & " ': what you need to show code on a page. The rest of the text does not change.
- Also accents and symbols: useful when an old system damages everything that is not ASCII.
- Every character: each sign becomes an entity, except line breaks and tabs.
Decoding
Paste text containing entities into the second box. All HTML 5 entities are recognised, as well as decimal and hexadecimal numbers. The result is displayed as plain text: no tag is ever executed.
Escaping is not always enough
Converting < > & " ' protects text placed between two tags or inside a quoted attribute. It is not enough for a web address, a script or a style sheet, which have their own rules. On a website, let your template engine escape the data.
Frequently asked questions
Do I need to encode accented letters?
Not on a UTF-8 page, which is the usual case today. Accent entities only help with tools or files that handle encodings badly.
What is for?
It is a non-breaking space: the two words it separates stay on the same line. Several in a row are not collapsed into one.
Why does the apostrophe become '?
The name ' did not exist in older versions of HTML. The number is understood everywhere.
Is my text sent anywhere?
No. The conversion happens in your browser and nothing is saved apart from your settings.