CraftTools

HTML Entity Encoder / Decoder

Guide: HTML Entities, Formatting and Minifying Explained

Nothing you enter or choose here leaves your device. This tool runs in your browser.

The characters that must be escaped

Five characters have special meaning in HTML. If you want them to appear as plain text, they need an entity, a code that starts with an ampersand and ends with a semicolon.

CharacterNamed entityNumberWhy
&&&Starts every entity
<&lt;&#60;Starts a tag
>&gt;&#62;Ends a tag
"&quot;&#34;Ends an attribute value in double quotes
'&#39;&#39;Ends an attribute value in single quotes

A real example

Say a visitor types <script>alert(1)</script> into a comment box and your page prints it back as it is. The browser runs it as code. Encoded, the same text is printed as &lt;script&gt;alert(1)&lt;/script&gt;, and the browser shows it as harmless words. This is the basic defense against cross-site scripting. In a real site, let your template engine or framework do the escaping automatically, and use this tool to check what the output should look like.

Three ways to write the same letter

The letter e with an acute accent can be written as &eacute; (named), &#233; (decimal) or &#xE9; (hex). They all show é. Named entities are the easiest to read, and numeric ones work for any character, including ones with no name. The encoder lets you pick how far to go: special characters only, or also every non-ASCII character in names, decimals or hex.

Do you need to encode accented letters at all?

Usually not. If your page is saved as UTF-8 and declares it with <meta charset="utf-8">, you can type é, the euro sign or Chinese characters directly. Encoding non-ASCII text is for places where the file's encoding can't be trusted, such as some email systems and old templates.

Entities worth knowing

EntityShowsUsed for
&nbsp;A space that won't breakKeeping a number and its unit together
&copy;Copyright signFooters
&euro;Euro signPrices
&hellip;EllipsisTrailing off
&mdash;Long dashBreaks in a sentence
&rarr;Right arrowLinks and steps

Decoding and common trouble

  • Double encoding. Text that shows &amp;lt; on the page was encoded twice. Decode once, and fix the code that encodes it a second time.
  • Missing semicolons. Only complete entities are decoded. &copy without the semicolon is left alone.
  • Unknown names. A name that doesn't exist in HTML is left as it is.
  • Wrong place. Escaping is different inside JavaScript strings, URLs and CSS. HTML entities only work in HTML text and attribute values.

Everything runs in your browser. For URL escaping, use the Base64 encoder in URL mode. To type symbols you can't find on your keyboard, see the special characters page, and the guide on typing emoji and special characters for shortcuts.

Written by Akinrinmade Michael · Updated October 24, 2026

How to use

  1. 1Choose Encode or Decode.
  2. 2For encoding, pick how far to go: special characters only, or also non-ASCII characters as names, numbers or hex.
  3. 3Paste your text.
  4. 4Click Copy result.

Frequently asked questions

Which characters must be escaped in HTML?

At minimum & and <, plus > and quotes inside attribute values. Escaping them stops text from being read as markup, which also helps prevent cross-site scripting.

What is the difference between named, decimal and hex entities?

They are three ways to write the same character: &eacute;, &#233; and &#xE9; all mean é. Named entities are easiest to read, and numeric ones work for any character.

Why is my entity not decoded?

Only complete entities ending with a semicolon are decoded, and the name must exist in HTML. Unknown names are left as they are.

Is my text uploaded?

No. Encoding and decoding happen in your browser.

Read the guides

Learn how this works and how to get the most from it.

Web & SEO

HTML Entities, Formatting and Minifying Explained

When to escape characters in HTML, how formatting and minifying differ, and how much minifying HTML, CSS and JavaScript really saves.

3 min read

Writing & text

How to Type Emoji and Special Characters on Any Device

Keyboard shortcuts for emoji and symbols on Windows, Mac and phones, how Unicode and HTML entities work, and why some characters break.

3 min read

String Escape / Unescape

Escape and unescape strings for JSON, JavaScript, Java, Python, HTML, SQL, regex and CSV.

HTML / XML Formatter & Minifier

Beautify or minify HTML and XML.

Base64 & URL Encoder / Decoder

Encode and decode Base64 and URL-encoded text instantly.

HTML to Markdown Converter

Convert HTML or pasted web content into clean Markdown.