Skip to content

HTML Entity Encoder

Escape special characters for HTML, or decode entities.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

HTML entity encoder

Escape and unescape HTML entities

More Developer Tools

View all tools

Every everyday developer tool, right in your browser.

No installs. No uploads. No signup.

Browse all 36 tools
Developer tools
36
Cheat sheets
10
Bytes uploaded
0

How to use the HTML entity encoder

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Choose the direction

    Encode or decode. Errors point at what's wrong with the input.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

HTML Entity Encoder: what to know

The HTML entity encoder escapes text so it displays as text in HTML instead of being read as markup: < becomes &lt;, > becomes &gt;, & becomes &amp; and quotes become &quot; and &#39;. The decoder does the reverse, turning named entities (&copy;, &nbsp;), decimal (&#169;) and hexadecimal (&#xA9;) references back into characters.

Escaping is how you show code samples on a web page and how templates keep user input from turning into tags. It's an important defense against cross-site scripting (XSS) when text is placed between tags or inside a quoted attribute. It isn't enough in other contexts, such as inside a script, a style or a URL attribute like href, which need their own escaping or validation.

In a page saved as UTF-8, which is nearly all of them, you don't need entities for accented letters, symbols or emoji: they can be written directly. Entities remain useful for invisible or ambiguous characters such as &nbsp; (a non-breaking space) and &shy; (a soft hyphen).

Popular uses

  • Showing HTML or XML code samples on a web page
  • Decoding entities in scraped or exported content
  • Escaping text for HTML attributes and templates
  • Cleaning &amp;amp; double-encoding bugs

Tips for the best result

  • &amp;amp; in your output means text was escaped twice; decode once and check where the first escape happens.
  • Let your template engine or framework escape by default rather than escaping by hand.
  • The HTML entities reference page lists common named entities with their codes.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions