If you've ever seen &, <, or © in HTML source code and wondered what they mean — those are HTML entities. They're how HTML displays characters that would otherwise be interpreted as code. Understanding them is essential for anyone who writes or works with HTML.
What HTML Entities Are
An HTML entity is a text string that the browser renders as a specific character. It always starts with an ampersand (&) and ends with a semicolon (;). Between them is either a named code or a numeric reference.
The most common named entities:
&→ & (ampersand)<→ < (less-than / opening angle bracket)>→ > (greater-than / closing angle bracket)"→ " (double quote)'→ ' (single quote / apostrophe) → non-breaking space©→ © (copyright)®→ ® (registered trademark)
Why You Need to Encode Certain Characters
HTML uses < and > to mark the start and end of tags. If you write <b> in your content, the browser interprets it as a bold tag, not the text "". To display the literal characters < and >, you must write < and >.
The ampersand itself has the same problem — since it starts all entities, a literal ampersand in your content must be written as & to avoid confusing the parser.
The double quote requires encoding inside HTML attribute values when wrapped in double quotes: <a title="She said "hello"">. In modern HTML, single-quoted attributes, or attributes without encoding, often work — but encoding is the safe standard.
Numeric HTML Entities
Any character can be encoded numerically using its Unicode code point:
- Decimal:
&→ & (ampersand, decimal 38) - Hexadecimal:
&→ & (hex 26)
Numeric references work for any Unicode character, including those without named entities. For example, the euro sign has a named entity (€) but can also be written as € or €. Named entities are more readable; numeric ones work universally.
When Modern HTML Doesn't Require Encoding
If your HTML is served as UTF-8 (which it should be — declare <meta charset="UTF-8"> in the head), you can include most Unicode characters directly in your HTML without encoding them. You don't need to write € — you can write € directly.
The exceptions — characters you always need to encode:
<→ always encode as<in content (it's an HTML syntax character)>→ encode as>(technically optional in content, required in tag context)&→ always encode as&(starts entity parsing)"in attribute values → encode as"
Decoding HTML Entities
When you receive HTML-encoded text in an API response, database, or scraped content, you'll see entities instead of characters. To convert it back to readable text, run it through an HTML decoder.
Example: She said “it’s done” & left. decodes to: She said "it's done" & left.
Decoding is especially common when: processing text exported from CMSs, consuming third-party APIs that HTML-encode their responses, or cleaning scraped web content for further processing.
Try the Free Tool
Convert special characters to HTML entities or decode HTML entities back to readable text. Instant, free.
HTML Encode / Decode →Frequently Asked Questions
What is & in HTML?
& is the HTML entity for the ampersand character (&). Since ampersands start HTML entity sequences, any literal & in HTML content must be written as & to prevent the HTML parser from treating it as the start of an entity.
What is in HTML?
is a non-breaking space — it creates a space between words that the browser won't use as a line break point. Unlike a regular space, keeps the words on either side together on the same line. It's commonly used to prevent orphaned words or to add spacing in HTML where CSS isn't an option.
Do I need to encode all special characters in HTML?
Only a few characters MUST be encoded: < (as <), & (as &), and " in attribute values (as "). Other special characters and Unicode symbols can be included directly in UTF-8 HTML. Encoding everything is safe but unnecessary in modern HTML.
What's the difference between named and numeric HTML entities?
Named entities like & and © are readable shorthand for specific characters. Numeric entities (& or &) reference any Unicode code point directly. Numeric entities work for any character; named entities only exist for commonly-used characters. Both work in any browser.
How do I decode HTML entities in JavaScript?
The simplest method: create a textarea element, set its innerHTML to the encoded string, and read the .value property — the browser decodes it automatically. For Node.js, use a library like 'he' or 'html-entities'. For one-off decoding, an online HTML entity decoder is the fastest option.