HTML Entity Encoder

Escape HTML characters such as <, > and & into entities so markup displays as text instead of rendering.

Try an example

Load a ready-made sample into this tool and run it. Every result you see is calculated live by the tool itself — nothing here is a pre-written answer.

Sample: input: <p>Hello & World</p>

How to Use

  1. Paste text or HTML.
  2. Click Run.
  3. Copy the escaped result.

What this HTML entity encoder does

This HTML entity encoder escapes the characters that carry special meaning in HTML — chiefly <, > and & — and replaces them with entities such as < and &. Escaped text displays on a web page exactly as written instead of being read as markup, which is what you want when showing code samples or angle brackets in content.

When to use it

Use it before pasting code examples, tags or comparison symbols into a page, a comment system or a template, so readers see the characters rather than the browser acting on them. It also helps when writing documentation about HTML itself, where the examples contain the very characters the page is built from.

Good to know

Only the characters that change meaning in HTML are escaped; the rest of your text passes through unchanged, including letters, numbers and ordinary punctuation. Encoding is a display safeguard, not a security treatment — it does not sanitise scripts or make untrusted input safe to run.

Frequently asked questions

Which characters get escaped?

The ones browsers treat as markup: angle brackets and the ampersand first of all, since & begins every entity. Escaping those three is enough to make ordinary text display literally; everything else in your text stays exactly as typed.

Will encoding break my text if I encode it twice?

Yes, in a visible way: the & in an existing entity becomes &, so < turns into &lt; and shows as code on the page. Encode once, from the original text, and decode first if the text was already escaped.

Is encoding the same as making HTML safe?

No. Escaping stops text being read as tags, which solves display problems. It is not a substitute for proper sanitising when you accept input from other people, because safety involves more than the three characters escaped here.

How to use HTML Entity Encoder

  1. Paste text or HTML.
  2. Click Run.
  3. Copy the escaped result.

Limitations

Only the characters that change meaning in HTML are escaped; the text itself is unchanged.

Browse all tools · More Text Converters tools

Scroll to Top