HTML Encode and Decode

Escape and Unescape HTML Entities.

Loading…

To show code on a web page, the angle brackets and ampersands in it must be written as entities, or the browser treats them as markup. Encoding does that; decoding reverses it.

Decoding understands every named and numeric entity, whether it is written as a word such as the one for a non-breaking space or as a number such as the code of the euro sign. An option also encodes letters outside ASCII for pages that cannot be saved as UTF-8.

How to use the HTML Encode and Decode tool

  1. Choose Encode or Decode.
  2. Paste the text or HTML.
  3. Copy the result.
  • Showing HTML or XML code inside a blog post
  • Cleaning text littered with visible ampersand and quote codes
  • Preparing user text for safe display

Tips for the best result

  • Encode before putting text inside an attribute value as well as between tags.
  • Text that shows the code for an ampersand in plain sight has been encoded twice; decode it twice.

Quick facts

PriceFree
Works withText
Where it runsIn your browser, on your device
AccountNot needed

Frequently asked questions

Which characters are encoded?

The five that matter in HTML: & and both quote marks.

Does encoding protect against script injection?

Escaping these characters is the core defence when showing user text in HTML.

What is the nbsp entity?

A non-breaking space, written as an ampersand, the letters nbsp and a semicolon. Decoding turns it into that character.

Will decoding run scripts in my text?

No. Tags are kept as text and nothing is executed.