Skip to content

HTML Entity Encoder

Escape text so it displays literally in HTML.

Quick Tool Overview

The HTML Entity Encoder escapes the characters that would otherwise be parsed as markup, so text displays literally. The default is the five characters that genuinely need it, which keeps the output readable rather than turning the whole string into entities.

What it does
Escapes characters into HTML entities
You give it
A code sample, snippet or user-supplied text
You get back
Escaped markup that displays literally
Best for
Code samples, tutorials and email templates
Text Tools Free, unlimited use No sign-up Runs in your browser

About the HTML Entity Encoder

Putting a less-than sign in an HTML page starts a tag. Putting an ampersand starts an entity. To display those characters literally — in a code sample, a tutorial or any user-supplied text — they have to be escaped into entities first.

Five characters genuinely need escaping in HTML: the ampersand, the two angle brackets, the double quote and the single quote. This tool escapes those by default, which is the correct minimum and keeps the output readable. It can also escape every non-ASCII character into a named or numeric entity, which is occasionally needed for email templates and older systems that mangle UTF-8. Named entities are used where one exists, since © is far more readable than ©.

Key features of the HTML Entity Encoder

The correct minimum by default

Ampersand, both angle brackets and both quote characters — the five that actually need escaping.

Named entities where they exist

© instead of ©, because readable source is worth more than a byte or two.

Full escaping when needed

Escape every non-ASCII character for the older systems that mangle UTF-8.

Numeric fallback

Characters with no named entity get their numeric form automatically.

Honest about XSS

The page says plainly that context-aware framework escaping is the security answer, not this tool.

How to use the HTML Entity Encoder

  1. 1

    Paste your text

    A code sample, a tutorial snippet or any text going into HTML.

  2. 2

    Choose how much to escape

    The five required characters, or everything outside ASCII as well.

  3. 3

    Pick named or numeric entities

    Named entities are more readable; numeric ones work everywhere.

  4. 4

    Copy the escaped markup

    Paste it straight into your page and it will display literally.

Frequently asked questions

The ampersand and the two angle brackets always. Inside an attribute value, the quote character used to delimit it must be escaped too. Escaping all five is the safe default.

Reviews of the HTML Entity Encoder

What people who use the HTML Entity Encoder think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the HTML Entity Encoder. It takes half a minute and no account.

Write the first review

More text tools