Skip to content

All tools

HTML Entity Encoder

Escape text for HTML (< & …) or turn entities back into text.

  • 100% free
  • Runs in your browser

Mode

0 characters

Last reviewed by the OnlineToolPro team

What is the HTML Entity Encoder?

Characters like < and & have special meaning in HTML. Encoding turns them into entities (&lt;, &amp;) so they show as text; decoding turns entities back into normal characters.

How it works

How to use the HTML Entity Encoder

3 simple steps. No experience needed.

What can you use it for?

  • Show code examples on a web page.
  • Make user-entered text safe to place in HTML.
  • Read text full of &amp; and &#39; codes.

When you need to encode

Encode text before placing it inside HTML when it might contain < > & or quotes — for example code samples in a blog post, or user-written text. Otherwise the browser may read it as markup.

Named and numeric entities

Named entities like &amp;copy; are easy to read. Numeric entities like &amp;#169; work for any character. The decoder understands both.

FAQ

Frequently asked questions

Which characters are encoded?

& < > " and ' by default. You can also encode every accented letter and symbol as a numeric entity.

Is encoding enough to prevent XSS?

Encoding text placed between HTML tags is an important part of it, but safe output also depends on where the text goes — attributes, URLs and scripts each need their own handling. Use your framework's built-in escaping in real applications.

What does &nbsp; mean?

A non-breaking space: a space that doesn't let the line wrap at that point.

Other tools you might find useful next.

More Developer Tools

Format, convert and check code and data. 9 free tools.

Browse Developer tools
Other categories:YouTubeTextImagesPDFs