Free converter

HTML Entity Encoder and Decoder

Paste text to turn characters such as less than, greater than, ampersand and quotes into safe HTML entities, or decode entities back into normal text.

What is html entity encoder and decoder?

HTML uses some characters as code, so to show them as text you must write them as entities. A less than sign becomes the entity lt and an ampersand becomes amp.

This tool encodes and decodes entities. It can also convert accented and non Latin characters to numeric entities for systems that do not support them.

How to use the html entity encoder and decoder

  1. Paste your text.
  2. Choose encode or decode.
  3. Copy the result.

How the html entity encoder and decoder works

Encoding replaces ampersand, less than, greater than and both quote types with their entities. With the extra option on, every character above standard ASCII becomes a numeric entity. Decoding uses the browser parser to turn entities back into characters.

Worked example

The text Tom & Jerry becomes Tom & Jerry when encoded.

Common uses of the html entity encoder and decoder

  • Showing code samples in a web page.
  • Fixing broken characters in a CMS.
  • Preparing text for XML or email templates.
  • Learning about web security.
  • Decoding entities in scraped data.

Tips and common mistakes

Always encode user supplied text before you show it in a page.

Decode only text you trust.

Background: what to know before you rely on it

HTML entities exist because angle brackets and ampersands have special meaning in markup. If a page prints user input without encoding, a visitor could insert a script that runs in other visitors browsers. That attack is called cross site scripting, and output encoding is one of its main defenses. Modern frameworks encode by default, but copy and paste work in editors and templates still needs care. Named entities are readable, while numeric ones work for any character.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all converters, or browse the full list of tools.

Frequently asked questions

Why encode HTML?

So that browsers show the characters instead of running them as code, which also helps prevent cross site scripting.

What is a numeric entity?

A code such as é that stands for one character by its number.

Does decoding run scripts?

No. The tool only reads the text value.

Is it the same as URL encoding?

No. URL encoding uses percent signs.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Check critical conversions with an official source.