About the HTML Encoder
To show a piece of code, a math expression or any text with < and > on a web page, those characters have to be written as HTML entities. Otherwise the browser reads them as tags. The HTML Encoder converts your text for you: < becomes <, & becomes &, and quotes become " and '.
By default, only the five characters that matter in HTML are encoded, which keeps the result readable. You can also encode every character outside basic ASCII, such as accented letters, symbols and emoji, for systems that cannot handle UTF-8, or encode every character for special cases. Entities can be written as names (é), decimal numbers (é) or hex numbers (é).
Encoding text before you insert it into HTML is also what keeps user input from turning into running scripts. Everything happens in your browser.
How to use it
- Paste your text or codePaste the text you want to show on a page, or drop a file onto the box. Sample loads a short HTML snippet with accents, a euro sign and an emoji.
- Choose what to encodeSpecial characters encodes & < > " and '. Plus non-ASCII also encodes accents, symbols and emoji. Every character encodes everything except line breaks and tabs.
- Pick the entity styleNamed entities are easiest to read. Decimal and hex numbers work for every character, including those without a name.
- Keep spaces if neededTurn on "Spaces as " to stop the browser from collapsing runs of spaces or breaking a line between two words.
- Copy the resultThe status line counts the encoded characters. Copy the result or download it as an .html file.
Key features
Safe HTML in one step
Encodes the five characters that could be read as markup: & < > " and '.
Three scopes
Only special characters, special plus non-ASCII, or every character.
Three entity styles
Named (é), decimal (é) or hexadecimal (é). Characters without a name fall back to a number.
Emoji and symbols
Characters outside the basic plane, such as 😋, are encoded as one entity, 😋, not as two broken halves.
Non-breaking spaces
Optionally turn every space into to keep words together.
Private by design
Nothing is uploaded. Your code and text stay in your browser.
Examples
Showing HTML code on a page
The Sample button loads this line:
<p class="note">Café & crème brûlée cost €4 — "très bon" 😋</p>
With the default settings, 9 characters are encoded:
<p class="note">Café & crème brûlée cost €4 — "très bon" 😋</p>
Put that inside a page and visitors see the original tag as text instead of a styled paragraph. The accents, euro sign, dash and emoji stay as they are, because UTF-8 pages show them fine.
Encoding non-ASCII characters too
With Plus non-ASCII, the same line has 17 characters encoded. The accented letters and symbols look like this in each style:
| Character | Named, decimal and hex |
|---|---|
| é | é é é |
| € | € € € |
| — | — — — |
| 😋 | 😋 😋 😋 |
The emoji has no name, so even the Named style uses its number.
Code snippets
if (a < b && c > d)becomesif (a < b && c > d)It's 5 > 3becomesIt's 5 > 3<script>alert(1)</script>becomes<script>alert(1)</script>, which a browser shows as text and never runs
Symbols with names
With Plus non-ASCII and Named, © 2026 ™ ½ × → ♥ becomes © 2026 ™ ½ × → ♥.
Tips
- For normal web pages saved as UTF-8, Special characters is all you need. Encoding accents and emoji only makes the source harder to read.
- Use Plus non-ASCII for HTML emails and for systems that store text in an old character set. Entities then survive any conversion.
- When you write a tutorial or documentation, encode code samples before you paste them inside <pre> or <code> tags.
- Turn on "Spaces as " for short pieces such as "10 km" or "Fig. 3", where a line break between the parts would look wrong. Do not use it for whole paragraphs.
- To reverse the process, paste the encoded text into the HTML Decoder.
Common mistakes and limits
- Encoding twiceEncoding text that already contains entities turns & into &amp;, so visitors see "&" on the page instead of "&". Encode the original text only once.
- Encoding HTML you want to renderEncoding is for showing code as text. If you encode markup that should create a heading or a link, it shows up as plain text instead.
- Relying on encoding inside scripts and URLsHTML entities protect text placed between tags and in quoted attributes. Inside <script> blocks, style blocks or URLs, different escaping rules apply.
- Using Every character for normal contentIt turns "Hi" into Hi. That can hide text from simple scrapers, but it makes pages larger and harder to maintain.
- Expecting the apostrophe to use a nameThe apostrophe is always written as ', because ' is not supported in older HTML versions and some email clients.