HTML Entity Encode
Turn <, >, & and quotes into HTML entities so code displays as text instead of running.
HTML Entity Encode
HTML treats characters such as <, > and & as code. To show a snippet of markup on a page instead of running it, those characters have to be replaced by entities. This tool does the replacement for you in one click.
How to use HTML Entity Encode
- Paste your HTML or plain text into the box.
- Click Encode into HTML Entities.
- Use Copy and paste the result into your page, CMS field or documentation.
When it comes in handy
- Showing example code in a blog post or help article without the browser rendering it.
- Escaping user-supplied text before it is placed into an HTML template.
- Preparing snippets for a CMS editor that strips or executes raw tags.
Frequently asked questions
Which characters get encoded?
The characters that carry meaning in HTML: the less-than and greater-than signs, the ampersand and quotation marks. Ordinary letters and digits are left alone.
Is encoding the same as sanitising?
No. Encoding makes text display literally, which is the right defence when you print untrusted text inside HTML. Removing tags or attributes is a different job, and a server-side library should handle it.