inyourbrowser.com

HTML encode

Convert special characters to their HTML entity equivalents. Paste any text and get a safe 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 uses a lookup map to replace characters like <, >, and &with their named HTML entities. Decoding uses the browser's built-in DOMParser to reverse the process. Both run entirely in your browser. No server required.

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 converts characters that have special meaning in HTML, like < (less-than) and & (ampersand), converted to their entity equivalents (&lt; and &amp;). This prevents them from being interpreted as HTML 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.

Related tools

URL encode / decode
Percent-encode and decode URLs, or parse query strings into key-value pairs.
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.