NathanTools

HTML Entities Encoder & Decoder

Escape characters like <, > and & into HTML entities, decode entities back to text, or search the reference table for any symbol's code.

100% free No sign-up Works on any device

Report a bug

HTML Entities Encoder

Input

Output

Converts as you type. Nothing leaves your browser. Ctrl + Enter copies the result.

HTML entity reference

CharNamedDecimalHexDescription
& Ampersand
< Less-than sign
> Greater-than sign
" Double quote
' Apostrophe / single quote
␣ Non-breaking space
␣ En space
␣ Em space
␣ Thin space
- Soft hyphen (break point)
– En dash
— Em dash
‘ Left single quote
’ Right single quote
“ Left double quote
” Right double quote
« Left angle quote
» Right angle quote
… Ellipsis
• Bullet
· Middle dot
§ Section sign
Pilcrow (paragraph)
† Dagger
© Copyright
® Registered trademark
™ Trademark
° Degree
✓ Check mark
✗ Ballot X
★ Black star
♥ Heart
♠ Spade
± Plus-minus
× Multiplication
÷ Division
≠ Not equal
≤ Less than or equal
≥ Greater than or equal
≈ Approximately equal
∞ Infinity
½ One half
¼ One quarter
¾ Three quarters
² Superscript two
³ Superscript three
µ Micro sign
‰ Per mille
€ Euro
£ Pound sterling
¥ Yen / yuan
¢ Cent
₹ – Indian rupee
₩ – Korean won
₿ – Bitcoin
← Left arrow
→ Right arrow
↑ Up arrow
↓ Down arrow
↔ Left-right arrow
⇒ Double right arrow
↵ Carriage return
é e acute
è e grave
ü u umlaut
ö o umlaut
ñ n tilde
ç c cedilla
ß Sharp s
å a ring
Click a code to copy it70 entities

Updated November 2026 · Uses the browser's HTML parser · Runs locally

How to encode and decode HTML entities

  1. Encode escapes the five reserved characters & < > " ', which is what you need to show code or user input safely on a web page.
  2. Encode all non-ASCII also converts accented letters, symbols and emoji, as named entities where they exist or as decimal or hex codes. Use it for old systems, emails or XML that can't handle UTF-8.
  3. Decode turns any named or numeric entity back into the character, for example when cleaning text exported from a CMS.
  4. Need one symbol? Search the reference table and click the code to copy it.

Named, decimal and hex entities

Every character can be written in up to three ways. All three display the same in a browser:

FormExample for ©Notes
Named&copy;Readable, but only about 2,000 characters have names
Decimal&#169;Works for any Unicode character (169 is U+00A9)
Hexadecimal&#xA9;Same as decimal, matches the U+ code point

Emoji and characters outside the basic plane use a single entity for the whole character: 😀 is &#128512; (&#x1F600;), not two codes. XML and XHTML only recognise &amp; &lt; &gt; &quot; &apos;, so use numeric entities there.

When you need entities, and when you don't

  • Always escape < and & in text you insert into HTML, and quotes inside attribute values. Otherwise the browser may read your text as markup, or broken markup.
  • Showing code examples in a blog post or documentation: encode the snippet so <div> appears as text instead of creating an element.
  • Invisible characters such as non-breaking spaces and soft hyphens are clearer as entities, because you can see them in the source.
  • You don't need entities for é, €, → or emoji on a modern page saved as UTF-8 with <meta charset="utf-8">. Typing them directly is simpler and makes the source easier to read.

HTML escaping in code

LanguageEscapeUnescape
PHPhtmlspecialchars($s, ENT_QUOTES)html_entity_decode($s)
Pythonhtml.escape(s)html.unescape(s)
C# / .NETWebUtility.HtmlEncode(s)WebUtility.HtmlDecode(s)
JavaScriptSet element.textContent instead of building HTML stringsnew DOMParser().parseFromString(s, "text/html").body.textContent

For URLs use the URL encoder, and for JavaScript or JSON escapes use the Unicode encoder.

Frequently asked questions

HTML entities are codes that represent characters in HTML. They start with & and end with ;, either as a name (&copy;) or as a number (&#169; in decimal or &#xA9; in hex). Browsers display the character instead of the code.

In text, always escape & as &amp; and < as &lt;. Inside attribute values, also escape the quote you used around the value: " as &quot; or ' as &#39;. Escaping > as &gt; is optional but common. Everything else, including accented letters and emoji, can be typed directly in a UTF-8 page.

&nbsp; (or &#160;). It looks like a normal space but stops the browser from breaking the line there, which is useful between a number and its unit, such as 10&nbsp;km. Don't use rows of &nbsp; for layout; use CSS margin or padding instead.

Named entities like &copy; are easier to read. Numeric entities like &#169; work for every Unicode character, including those without a name (for example the rupee sign ₹ is &#8377;), and are safer in XML, which only knows five named entities. Both display the same in HTML.

Escaping user input before putting it into HTML text is an essential defence against cross-site scripting, but it's context-specific: values inside JavaScript, URLs or CSS need their own escaping. Use your framework's built-in output encoding rather than escaping by hand.

No. Encoding and decoding happen in your browser, and decoding never runs the HTML, so pasted scripts can't execute.

Comments

No comments yet.

Share this tool

HTML Entities Encoder

Favorites

Drag to reorder, or use the arrows. Categories and the tools inside them can both be moved.

Saved in this browser. Sign in to keep them on every device.

Esc
↑ ↓ to moveEnter to open