How to use
- Choose Encode and enter text.
<,>,&,"and'come out as entities, ready to show HTML source on a page or to place inside an attribute. - To convert letters with accents, symbols and emoji too, change the encode scope to
+ non-ASCIIorEverything but letters, digits, spaces. - Pick a reference style: named (
©), decimal (©) or hex (©). Characters without a name fall back to decimal, even in named-first mode. - To turn text like
<p>back into characters, choose Decode. Names the tool does not know are left alone and counted.
The five characters you must escape
| Character | Entity | Without escaping |
|---|---|---|
& |
& |
the text after it may be read as an entity |
< |
< |
read as the start of a tag |
> |
> |
read as the end of a tag |
" |
" |
cuts a double-quoted attribute short |
' |
' |
cuts a single-quoted attribute short |
Putting user-supplied text into HTML without escaping lets a <script> tag run, which is the classic XSS hole. A sentence like 5 < 6 can also be parsed as a tag and break the layout. In body text &, < and > are enough, but inside attribute values the quotes need escaping too. The default scope (The 5 required characters) covers both cases.
Named, decimal and hex references
The same © sign can be written three ways with identical results.
| Style | Example | Notes |
|---|---|---|
| Named | ©, —, € |
easy to read, only for characters that have a name |
| Decimal | ©, —, 한 |
works for every character |
| Hex | ©, —, 한 |
matches the Unicode chart number (U+00A9), easy to look up |
Characters outside the BMP, such as emoji, become one code point rather than two surrogate halves: 😀 is 😀 or 😀. Encoding café © | 한 😀 with the + non-ASCII scope gives:
- Named first:
café © — 한 😀(Hangul has no names, so decimal) - Decimal:
café © — 한 😀 - Hex:
café © — 한 😀
Decoding rules and caveats
- Named references use a table of about 250 common names: Latin-1 letters, Greek, math symbols, arrows, quotes and dashes. It is not the full HTML5 list of 2,000+ names. A name that is not in the table stays as written and is counted.
- Old forms without a semicolon, such as
&,<,>,",©,®and , are read as well. Numeric references (©,©) work without a semicolon too. �, the surrogate range (�to�) and values above 10FFFF become the replacement character�(U+FFFD).- Decoding is plain string processing and never uses the browser’s HTML parser, so a
<script>in the input is never executed. - Text is decoded once:
&lt;becomes<, not<. If text was encoded twice, decode it a second time. - In a UTF-8 document there is no need to encode accented letters or Hangul. Keep the scope on
The 5 required characters.
Related tools
- URL Encoder / Decoder: percent-encoding for addresses.
- Base64 Encoder / Decoder: convert text or files to Base64.
- HTML Beautifier & Minifier: tidy or shrink markup.
- HTML to Markdown: turn HTML into a Markdown document.
The text you enter is processed in your browser only and never sent to a server.