HTML entity converter

Encode special characters like <, >, & and quotes into HTML entities, or decode entities back to text. Safely show code on web pages. Free converter.

Encode and decode HTML entities

Some characters have special meaning in HTML. A < starts a tag and an & starts an entity, so if you want to display them as text, you write them as HTML entities: &lt;, &gt;, &amp;, &quot; and &#39;. Entities can also represent symbols like © (&copy;) and accented letters.

Choose Encode to turn special characters into entities, for example to show a code sample on a web page. Choose Decode to turn entities back into normal characters, for example when text from a feed or database is full of &amp; and &#8217;.

Encoding output is also a basic defence against HTML injection when you display user-supplied text.

How to use the html entity converter

  1. Paste the text or HTML.
  2. Choose Encode or Decode.
  3. Submit to convert.
  4. Copy the result.

Examples

Encoding a code sample

Input: <a href="/x">Tom & Jerry</a>

Output: &lt;a href=&quot;/x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

Paste this into a page and visitors see the code instead of a link.

Accents and symbols

Input: café © 2026

Output: caf&eacute; &copy; 2026

Characters with named entities are converted too.

Apostrophes

Input: it's

Output: it&#039;s

Decoding

Input: &copy; 2026 &mdash; caf&eacute; &lt;b&gt; &#8364;5

Output: © 2026 — café <b> €5

Named entities (&copy;) and numeric ones (&#8364;) both decode.

Common uses

  • Displaying HTML or code snippets on a web page or blog post.
  • Cleaning text from RSS feeds, APIs or databases that contain entities.
  • Escaping user-generated text before inserting it into HTML.
  • Writing special symbols in HTML emails.
  • Fixing double-encoded text like &amp;amp;.
  • Showing HTML or XML code examples in a blog post or documentation.

Tips and things to know

  • If you see &amp; on a page, the text was encoded twice; decode once to fix it.
  • In modern UTF-8 pages, you only strictly need to encode <, >, & and quotes in attributes. Other characters can be typed directly.
  • Escaping alone isn't a full security solution. Use your framework's built-in output escaping.
  • To strip tags completely instead, use the HTML tags remover. For character codes, try the decimal converter.

Edge cases and limitations

  •   decodes to a non-breaking space, which looks like a normal space but behaves differently in code and spreadsheets.
  • Encoding text that's already encoded turns & into &amp;. Decode first if you're not sure.
  • Emoji aren't converted to entities; they stay as they are, which is fine in UTF-8 pages.

Frequently asked questions

What is an HTML entity?

A text code that represents a character in HTML, written as &name; or &#number;, such as &lt; for <.

Why do I need to encode < and >?

Browsers treat them as the start and end of tags. Encoding them makes the browser display them as characters.

What does   mean?

A non-breaking space, which keeps two words on the same line and isn't collapsed like normal spaces.

Why does my text show &#39; or "?

The text was encoded for HTML but is being displayed somewhere that doesn't decode it. Decode it here.

Should I encode accented letters?

Not on modern UTF-8 pages: café displays fine as it is. Encoding is mainly needed for <, >, & and quotes.

Related tools

Popular free tools