Tools › Text & Data › HTML Entity Encoder / Decoder
๐Ÿท๏ธ

HTML Entity Encoder & Decoder

Escape text so it is safe to place in HTML, or decode entities like & and © back into readable characters.

How it works

Five characters have special meaning in HTML and must be escaped when they appear as text: & becomes &amp;, < becomes &lt;, > becomes &gt;, and the quotes " and ' become &quot; and &#39;. Escaping user-supplied text this way is the first line of defence against cross-site scripting (XSS).

"Encode all non-ASCII" also converts characters such as รฉ or ยฉ to numeric entities (&#233;), which is useful for legacy systems that do not handle UTF-8.

Frequently asked questions

Why do I need to escape ampersands in HTML?

An unescaped & can be read as the start of an entity, so text like &copy=1 in a URL may be turned into a copyright sign. Writing &amp; is always safe.

Does escaping prevent XSS?

It prevents it for text placed between tags or in quoted attributes. Use it on every user-supplied value, and use context-appropriate escaping for JavaScript, CSS and URLs.

What is the difference between named and numeric entities?

Named entities (&copy;) are readable; numeric ones (&#169;) work for any character and do not depend on a name table.

More tools

{ } JSON Formatter & Validator๐Ÿ“Š CSV to JSON Converter๐Ÿงช Regex Tester๐Ÿ†š Text Diff Checker๐Ÿ”ค Base64 Encode / Decode๐Ÿ”— URL Encode / Decode๐Ÿ”  Case Converter๐Ÿ“ Word & Character Counter๐Ÿ”ข Number Base Converter๐ŸŒ URL Slug Generatorโ†•๏ธ Sort & Deduplicate Lines๐Ÿ”ก Text to Hex / Binary ConverterAll Text & Data tools →
Copied to clipboard