🔒 100% private — runs in your browser, nothing is uploaded

HTML Entity Encoder

Encode special characters to HTML entities online — or decode entities back to text.

HTML entities let you display reserved characters safely — essential when showing code samples or user content in web pages.

How to use

  1. Paste text or HTML.
  2. Encode turns < > & into entities; Decode reverses it.
  3. Copy the result.

About this tool

Encoding prevents the browser from interpreting your text as markup.

Everything runs locally.

Use this page as an online HTML entity encoder for special characters: paste text containing &, <, >, double quotes or single quotes and Encode turns them into &, &lt;, &gt;, &quot; and ', so the browser shows them as text instead of reading them as markup. For example, <p>Hello & "welcome"</p> becomes &lt;p&gt;Hello & &quot;welcome&quot;&lt;/p&gt;. Decode does the reverse when copied markup arrives already entity-encoded.

How it works

In HTML, &lt; &gt; & " and ' are syntax. To show them as text you write entities: &lt; &gt; &amp; &quot; '. The browser renders &lt;div&gt; as the visible text <div> instead of creating an element.

Encoding user input before inserting it into a page is the basic defense against cross-site scripting (XSS). If a comment containing <script> is stored as &lt;script&gt;, the browser never executes it.

Named entities (&amp;) are the readable option; numeric ones (& or &#x26;) can represent every Unicode character. Decoding reverses the process — handy when scraped pages arrive double-encoded.

To encode special characters online you do not need the full entity table — only five characters carry markup meaning. After encoding, check the output against the reference table below: every &, &lt;, &gt;, double quote and single quote in your input should appear as an entity, and everything else should pass through untouched.

Worked examples

Showing code in a blog post: To display <p>Hello</p> as text in your article, encode it to &lt;p&gt;Hello&lt;/p&gt; — otherwise the browser swallows it as a real paragraph element.

Fixing double-encoded text: Seeing &amp;amp; on a page means the text was encoded twice. Decode once to get &amp;, decode again to get &.

Quick reference

CharacterNamed entityNumeric
&&amp;&#38;
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&#39;&#39;
(non-breaking space)&nbsp;&#160;

Frequently asked questions

When do I need entities?

When displaying <, > or & as text in HTML, or sanitizing user input for display.

What is &amp;?

The entity for an ampersand itself — entities can be nested.

Is my input uploaded?

No.

How do I encode special characters to HTML entities online?

Paste the text into the box and press Encode. The characters HTML treats as syntax — &, <, >, double quotes and single quotes — come out as &, &lt;, &gt;, &quot; and ', ready to paste into a page where they should display as text.

Does this encoder change letters, numbers or symbols like ©?

No. It encodes only the five characters that have special meaning in HTML markup. Letters, digits and symbols such as © pass through unchanged — on a UTF-8 page you can normally use those characters directly.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/htmlencode/" title="HTML Entity Encoder" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

First time embedding? Read the step-by-step guide →

More free tools