How to use the HTML Entity Encoder tool
- Paste the contentAdd plain text you want to make HTML-safe, or markup littered with entity codes.
- Pick a directionEncode converts risky characters into entities; Decode turns entity codes back into characters.
- Choose how much to escapeHandle just the five reserved HTML characters, or also convert accented letters and symbols into named, decimal or hex codes.
- Grab the outputCopy it, or press “Use result as input” to run the reverse conversion.
HTML entity tool features
- Reserved characters escapedAmpersands, angle brackets and both quote marks are converted, so user content can’t break your markup.
- Pick the entity styleWrite non-ASCII characters as names (©), decimal numbers (©) or hex numbers (©).
- Full entity decodingDecoding uses the browser’s own HTML parser, so every named entity in the spec is understood.
- Emoji handled properlyCharacters beyond the basic plane, emoji included, become one correct numeric entity.
- Visible repeated spacesOptionally preserve double spaces by inserting .
What are HTML entities?
A few characters are reserved in HTML: a less-than sign opens a tag and an ampersand opens an entity, so typing them straight into content can break a page or open a security hole. Entities are short codes that stand in for those characters safely. Writing < shows a less-than sign, and & shows an ampersand. They also cover symbols that are awkward to type, like ™ or ₹.
Characters you must always escape
- The ampersand becomes
&, because every entity begins with one. - The less-than sign becomes
<, because it opens a tag. - The greater-than sign becomes
>, because it closes a tag. - The double quote becomes
", because it ends double-quoted attribute values. - The apostrophe becomes
', because it ends single-quoted attribute values.
Frequently used HTML entities
- Non-breaking space:
or  - Copyright sign:
©or© - Registered trademark:
®or® - Trademark:
™or™ - Euro and pound signs:
€/€and£/£ - Em dash and ellipsis:
—/—and…/… - Curly double quotes:
“ ”or“ ”
Are entities still needed for accents and symbols?
Mostly not. Today’s pages are saved as UTF-8 and declare <meta charset="utf-8">, so characters such as ü, ç, ₹ and emoji can be typed directly. Numeric or named codes for non-ASCII characters mainly help with legacy systems, email templates, XML that has to stay pure ASCII, or files whose encoding you can’t guarantee. The five reserved characters above, though, must always be escaped in text and attributes.
Escaping and XSS security
Escaping user-supplied text before putting it into HTML is a core defence against cross-site scripting (XSS). In production apps, let your template engine handle it automatically, for example Laravel Blade’s {{ }}, React’s JSX or Django templates. To make text safe for URLs instead, use the URL Encoder & Decoder, and for binary data the Base64 Encoder.