HTML Entity Encoder
Paste text or markup to escape it into HTML entities. The five reserved characters are always encoded, and you can optionally convert accented letters and emoji to numeric entities. Everything runs in your browser.
How to encode HTML entities
- Paste the text or HTML you want to escape.
- Turn on non-ASCII encoding if you also need accents and emoji as numeric entities.
- Copy the encoded output and drop it straight into your HTML.
Examples
Escape a markup snippet
<div class="x">a&b</div>
<div class="x">a&b</div>
Frequently asked questions
What are HTML entities?
HTML entities are stand-in codes for characters that would otherwise have special meaning in HTML. They start with an ampersand and end with a semicolon, like & for an ampersand or < for a less-than sign.
Why do I need to escape these characters?
Characters like <, > and & control how a browser parses HTML. If you want them shown as literal text instead of treated as tags or entity starts, you have to encode them so the page renders what you actually typed.
What is the difference between named and numeric entities?
Named entities use a readable label, such as & or ". Numeric entities use the character's Unicode code point, such as é for an accented e. This tool uses named entities for the core characters and numeric entities for everything above ASCII.
Does encoding HTML entities prevent XSS?
Escaping the reserved characters is a key defense against cross-site scripting when you insert untrusted text into HTML, because it stops that text from becoming live tags or attributes. It is one important layer, not a complete fix, so still use context-aware escaping and a content security policy.
Why is the ampersand encoded first?
Each entity itself contains an ampersand, so the tool replaces every literal & before adding the others. That prevents double-encoding, where < would wrongly become &lt;.
Is my text uploaded anywhere?
No. The encoding runs entirely in your browser, so your text never leaves your device.
Related tools
HTML Entity Decoder
Decode HTML entities online. Turn named, decimal and hex entities like & and é back into plain text and symbols. Runs in your browser.
URL Encoder
URL encode text online with percent-encoding. Escape spaces and reserved characters for a query value, or encode a full URL. Free and private.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.
Base64 Decode
Decode Base64 to plain text online. Paste a Base64 or base64url string and get instant UTF-8 output. Free, fast and runs in your browser.