HTML Entities Encode and Decode
This tool lets you encode and decode HTML entities: “&” becomes “&” and back, optionally with named, decimal or hexadecimal references for accented letters, the euro sign and other special characters. Your text never leaves the browser.
Source: WHATWG HTML Living Standard – Named character references. Updated: .
How it is calculated
HTML entities – what they are for
HTML entities (character references) stand for characters that have a special meaning in source code or are hard to type. The five most important are & for the ampersand, < and > for the angle brackets, " for the double quote and ' for the apostrophe. Without encoding, the browser would read a less-than sign in text as the start of a tag.
Named, decimal, hexadecimal
- Named:
äfor ä,€for €. Easy to read, but not every character has a name. - Decimal:
äfor ä. Works for any Unicode character. - Hexadecimal:
äfor ä, handy when you know the code point from a Unicode chart.
When to encode and when not
On UTF-8 pages accented letters and the euro sign may appear directly in text. You must encode the required characters whenever text is inserted into HTML, above all text from users: it prevents garbled display and is one building block against cross-site scripting. Depending on the place (HTML text, attribute, JavaScript, URL) different escaping applies.
Limits
The tool knows the common named references (Latin-1, typography, currencies, arrows, mathematics, Greek), not all of the more than 2,000 names in the WHATWG list. Unknown names stay unchanged when decoding and are reported. Decoding produces text, not active HTML.
Frequently asked questions
What are HTML entities?
Character references that stand for a character in source code, such as an ampersand, an angle bracket or an accented letter. They start with an ampersand and end with a semicolon.
How do I encode special characters for HTML?
Choose “Encode text into entities” and the “named” level. On UTF-8 pages, accented letters are also allowed without encoding.
How do I decode HTML entities?
Choose “Decode entities into text” and paste the text. Named, decimal and hexadecimal references are turned back into characters.
Which characters must I always encode in HTML?
The ampersand and the two angle brackets. In attribute values the quote character in use is added.
What is the difference between named and numeric entities?
Named ones have a readable name, numeric ones give the Unicode code point as a number. Numeric ones work for every character, named ones only for those that have a name.
Sources and legal basis
- WHATWG HTML Living Standard – Named character references
- MDN – Character reference: named and numeric reference syntax
As of: · Editorial policy
Related tools
- Base64 Encode and DecodeEncode and decode Base64 and Base64url with proper UTF-8, plus URL encode/decode (percent-encoding). Clear error messages, runs locally in your browser.
- JSON Escape / UnescapeJSON escape and unescape online: turn any text into a valid JSON string with escaped quotes, backslashes and line breaks, or decode it back – in your browser.
- HTML formatterHTML formatter: indent source code to make it readable, or minify it to a single line, with warnings about unclosed tags. Runs locally in your browser.
- Markdown to HTML converter: preview, HTML code, downloadMarkdown to HTML converter with live preview: headings, lists, tables and code following CommonMark. Clean HTML code to copy, safe with no scripts. Free.
- ASCII table with decimal, hex, octal, binary and Unicode lookupASCII table 0–127 plus Latin-1 and Windows-1252: decimal, hex, octal, binary, HTML entity, control codes. Search it, click to copy, convert text to codes.
- JSON formatter, validator and minifierValidate JSON against RFC 8259 with the exact line, column and a plain-English explanation. Beautify or minify, sort keys, copy. Runs locally in your browser.
- What is my IP address?What is my IP? See your public IPv4 or IPv6 address at once, plus approximate location, internet provider and browser details. Free, never stored.
- IEEE 754 converterIEEE 754 converter for half, single and double: convert decimal, hex or bits, and see sign, exponent, mantissa and the exact stored value with rounding error.
- Px to Rem ConverterPx to rem converter with your own base font size, plus em, pt, percent and vw, and a lookup table of common font sizes. Free, no sign-up, works offline.