HTML Entity Encoder / Decoder
HTML entities are special character sequences used to represent reserved and special characters in HTML documents. For example, "<" is written as <, and "&" as &. This tool encodes and decodes HTML entities.
Why HTML Entities Are Needed In HTML, some characters have special meaning: < and > denote tags, & starts an entity, " and ' are used in attributes. To display these characters as text, they must be replaced with HTML entities. This also prevents XSS attacks when outputting user data on a page.
Preview (rendered by browser):
Free online tool for encoding and decoding HTML entities. Convert special characters (<, >, &, ", ') to HTML entities (<, >, &, ", ') and back. Both named (&) and numeric (&, &) entities are supported.
HTML entities are necessary for correctly displaying reserved characters in HTML documents. The characters < and > are used for tags, & for starting entities, " and ' in attributes. Without escaping, these characters can break the HTML structure or create XSS vulnerabilities.
The tool is useful for web developers preparing content for HTML insertion, debugging code with HTML entities, and processing user input. All computations are performed locally in your browser — data is never transmitted anywhere.
How to use it
- Paste text containing <, >, &, quotes or non-breaking spaces and press Encode to get a safe HTML representation.
- For the reverse, paste text with entities (<, &, , —) and press Decode.
- Choose the mode: only the mandatory characters, or every non-ASCII character as a numeric entity.
When it helps
- Showing code on a page: display an HTML or XML sample so the browser does not interpret the tags.
- Templates and CMS: insert user text into markup without breaking it or opening an XSS hole.
- Reading exports: decode text from RSS, XML or an old database where quotes and dashes are stored as entities.
Frequently asked questions
Which characters must be escaped?
At minimum &, < and > in text, plus quotes inside attributes. Everything else (dashes, typographic quotes, non-Latin letters) can be written directly in UTF-8 documents.
How is different from a normal space?
A non-breaking space forbids a line break at that point and does not collapse with neighbouring spaces. It is used between initials, before units and after short words.
Named or numeric entities?
Numeric ones (— or —) are understood by every parser, including XML. Named ones (—) are shorter and more readable but do not work in XML without a DTD.