Skip to content
ENCODING & DECODING

HTML Entity Encoder & Decoder Online

Escape HTML special characters or decode HTML entities.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

HTML Entity Encoder & Decoder

About HTML Entity Encoder & Decoder

HTML reserves the characters <, > and & for markup. To show them as text on a page, they must be written as the entities <, > and &. Escaping them correctly also helps prevent broken layouts and cross-site scripting caused by unescaped user input.

Use Encode to escape text so it can be placed inside HTML, such as a code sample in a blog post. Use Decode to turn entities such as ©, & or ₹ back into readable characters. Decoding is done by the browser's own HTML parser, so named and numeric entities are both supported.

How to use HTML Entity Encoder & Decoder

  1. Choose Encode to escape text or Decode to convert entities back to characters.
  2. Paste your text into the input box and click Run Tool.
  3. Copy the result into your HTML, CMS editor or code.

Example

Input

<a href="https://nhplearning.com">Tools & more</a>

Output

<a href="https://nhplearning.com">Tools & more</a>

Common uses

  • Showing HTML or PHP code inside a blog post without the browser rendering it.
  • Reading text that was exported with entities such as &amp; or '.
  • Escaping user-supplied text before placing it in a page template.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

Which characters does the encoder escape?

It escapes &, < and >. Quotation marks are not changed, so if you place the result inside an HTML attribute, replace double quotes with " as well.

Is this enough to prevent XSS?

Escaping output is an important part of it, but the right escaping depends on the context. In WordPress, use esc_html(), esc_attr() and esc_url() when you output data.

Why do I see &amp; in my text?

The text was escaped twice. Decode it once to get back to & and again to get the plain & character.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.