inyourbrowser.com

HTML encode

Convert special characters to their HTML entity equivalents. Paste any text and get an HTML-encoded version where characters like <, >, &, and " are replaced with &lt;, &gt;, &amp;, and &quot;.

Mode:
0 chars
0 chars
COMMON ENTITIES
&&amp;
<&lt;
>&gt;
"&quot;
'&#39;
©&copy;
®&reg;
™&trade;
€&euro;
·&nbsp;
—&mdash;
…&hellip;

How it works

Encoding runs five replace calls in a fixed order, & first so the entities it inserts are not escaped a second time, turning &, <, >, " and ' into &amp;, &lt;, &gt;, &quot; and &#39;. Decoding lets the browser's own HTML parser reverse the process: the text, with every < escaped first, is parsed inside a detached <textarea>, which never creates elements. Both run entirely in your browser.

Processing runs in your browser

All encoding and decoding happens locally in your browser tab. Our servers are not involved at any point.

Related operations

For percent-encoding URL components, try URL encode. To encode binary blobs or images as text, use Base64. For previewing escaped markup, see the Markdown preview.

Frequently asked questions

What is HTML encoding?
HTML encoding replaces characters that have special meaning in HTML, such as < (less-than) and & (ampersand), with entities (&lt; and &amp;), so the browser shows them as text instead of reading them as markup.
Why is HTML encoding important?
When displaying user-supplied text in HTML, failing to encode it can allow HTML injection or cross-site scripting (XSS) attacks. Encoding ensures the text is displayed literally rather than interpreted as markup.
What characters get encoded?
At minimum: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot;, and ' becomes &#39;. This tool encodes all five.
Does this tool send my data anywhere?
All processing runs in your browser with JavaScript. Our servers are not involved at any point.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

Markdown previewer
Live Markdown-to-HTML preview with syntax support. All rendering runs in your browser.
XML formatter
Pretty-print, minify, and validate XML. Uses the browser's native DOMParser.
URL encode / decode
Percent-encode and decode URLs, or parse query strings into key-value pairs.