Developer · Step-by-step guide

How to Encode and Decode HTML Entities

HTML Encoder / Decoder turns special characters like <, > and & into HTML entities so they show as text on a web page instead of being treated as code, and turns entities back into normal text.

Open the HTML Encoder / Decoder Free · No sign-up · 4 steps · 2 min read

How to use it

  1. Paste your text

    Paste it into Enter text to encode or decode.

  2. Choose content or attribute

    Pick Encode for Content for text between tags, or Encode for Attribute for text inside an attribute like title="…".

  3. Press a button

    Press Encode HTML, or Decode HTML Entities to go back. There are also Escape for JS String and CSS Selector Escape.

    HTML encoder with a paragraph tag containing an ampersand, quotes and a pound sign
    Your text (1), content or attribute (2) and Encode HTML (3).
  4. Copy the result

    The result appears below with a character count.

    Encoded HTML entities for the sample text
    The encoded result (4).

Tips and common questions

Why encode HTML?

If you paste <b> into a page, the browser treats it as code. Encoding shows it as text and also helps block code injection (XSS) when showing user input.

Where can I look up an entity?

Open HTML Entity Reference at the bottom of the tool to browse all 252 named entities.

What is the difference from URL encoding?

HTML encoding is for text on a web page. URL encoding is for text inside a web address. Use the URL Encoder for links.

Privacy

Your data is processed inside your browser and is never uploaded, so it is safe to paste private or work data.

Ready to try it? The HTML Encoder / Decoder is free and needs no account.

Open the HTML Encoder / Decoder

See all tool guides →