HTML Entities Encode/Decode
Convert characters such as ampersands, angle brackets, quotes and accented letters to HTML entities, or turn entities like é and € back into readable text. Everything runs locally and nothing you paste is ever executed as HTML.
Runs in your browser. Your files are never uploaded.
Loading HTML Entities Encode/Decode…
How to use HTML Entities Encode/Decode
- Choose Encode or Decode.
- Paste your text or markup into the left box.
- For encoding, pick whether to convert only the five special characters or every non-ASCII character, and choose named, decimal or hexadecimal output.
- Copy the result, or use it as the new input to check a round trip.
What HTML entities are
An HTML entity is a text sequence that stands for a single character. It starts with an ampersand and ends with a semicolon. Between them is either a name, such as lt for the less-than sign, or a number prefixed by a hash sign, written in decimal or in hexadecimal when the hash is followed by an x.
Entities exist because some characters have a special meaning in markup. If a browser sees a raw less-than sign it assumes a tag is starting. Writing it as an entity tells the parser that you mean the visible character instead. The same idea protects ampersands and the quotes that wrap attribute values.
When to encode and when to decode
Encode when you are placing user-supplied or code-like text into an HTML document, when you want to show a snippet of markup as visible text on a page, or when you must send text through a channel that is not Unicode safe. Decode when you receive scraped, exported or copied content that is full of sequences like & and " and you want to read or reuse the real text.
Be aware that encoding is not a complete security measure. Escaping is correct only for the context it targets. Text placed inside a script block, a style block or a URL needs different escaping from text placed in the body of a page.
- Escape the ampersand first when doing it by hand, otherwise you will double-encode.
- Double-encoded text shows up as < in the output. Decode it twice to recover the original.
- The non-breaking space entity does not collapse like a normal space, which makes it handy but easy to overuse.
How this tool works and its limits
Encoding walks through your text one code point at a time, so emoji and other characters outside the basic plane stay in one piece. Decoding handles decimal and hexadecimal references directly and uses a built-in table for common names. For rarer names it asks the browser to resolve the name inside a text area, which treats its contents as plain text, so no element can ever be created from your input.
Entities written without a trailing semicolon, a legacy habit that some browsers tolerate, are not decoded here because they are ambiguous. Invalid numeric references, such as values in the surrogate range or beyond the Unicode limit, become the replacement character. Your text never leaves your device.
Why use this html entities encode/decode tool
- Three output styles. Write named entities such as ©, decimal references such as © or hexadecimal references such as ©.
- Safe decoding. Decoding produces plain text only. The input is never inserted into the page as HTML, so embedded script tags cannot run.
- Emoji and symbols. Characters outside the Basic Multilingual Plane, including emoji, are converted using their full code point.
- Unknown entities flagged. References the tool does not recognise are left untouched and listed, rather than silently dropped.
Frequently asked questions
Which characters must be escaped in HTML?
In text content you must escape the ampersand and the less-than sign. In attribute values you must also escape the quote character that delimits the value. Escaping the greater-than sign and the apostrophe as well is harmless and a common habit, and is what the "only special characters" option does.
Do I need entities if my page is UTF-8?
Usually not. A page served as UTF-8 with a correct charset declaration can contain accented letters, currency signs and emoji directly. Entities remain useful for reserved characters, for invisible characters such as the non-breaking space, and for systems that mangle non-ASCII text.
Why did a named entity come out as a number?
Only a well-known subset of the several hundred named entities is built into the encoder. Any character without a short, widely supported name is written as a numeric reference, which every browser understands.
More free tools
PX to REM Converter
Convert pixels to rem and em, and back, with a custom root font size. Includes a table of common sizes from 8px to 64px and a copy-ready CSS declaration.
Open toolBase64 Encode & Decode
Encode text to Base64 or decode Base64 back to text. Supports UTF-8 and URL-safe Base64. Free, instant and runs in your browser.
Open toolURL Encode & Decode
Encode or decode URLs and query strings with percent-encoding. Choose component or full-URL mode. Free, instant and private.
Open tool