HTML Entity Encoder & Decoder NZ

This tool encodes text into HTML entities and decodes entities back into ordinary characters, both directions in your browser. HTML entities are the special codes that let you display reserved or unusual characters on a web page without breaking the markup. A handful of characters have meaning in HTML: the angle brackets that open and close tags, the ampersand that begins an entity, and the quotation marks that wrap attributes. If you want to show these literally as text, rather than have the browser treat them as code, you must replace them with their entity equivalents, a process called escaping. The same applies to characters that are hard to type or that vary between systems, which can be written as named or numeric entities to display reliably everywhere. Getting this right is essential for two reasons: pages render correctly, and, more importantly, escaping user input is a core defence against cross-site scripting, where unescaped angle brackets could let someone inject a script into your page. This tool makes the conversion effortless. You paste your text, choose to encode or decode, and the result appears instantly. Encoding replaces the reserved characters, and any non-standard ones, with their safe entity codes, ready to paste into HTML. Decoding does the reverse, turning entities back into the characters they represent, which is handy when you are reading or cleaning up content that has been escaped. Everything runs locally, so nothing is uploaded. Use it to safely display code samples on a page, to escape content before inserting it into HTML, to clean up text copied from a source that over-escaped it, or simply to understand how entities work.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page
<p class="note">Tom & Jerry said "hi"</p>

Escaping HTML is a key defence against cross-site scripting. Runs entirely in your browser; nothing is uploaded.

How it works

To encode, the tool replaces the reserved HTML characters, the ampersand, the angle brackets and the quotation marks, with their named entity codes, so they display as literal text rather than being read as markup. To decode, it uses the browser's own parser to turn entity codes back into the characters they represent.

Worked example

Encoding the snippet that shows a paragraph tag with Tom & Jerry said hi replaces the angle brackets, the ampersand and the quotes with their entity codes, so it can be displayed on a page as visible text instead of being rendered as an element. Decoding that escaped string returns the original characters.

Related calculators