How-to guide

How to Encode HTML Entities Online Free in Seconds

Updated 2026-12-02944+ wordsFree tools · no signup

To encode HTML entities, paste your text into the HTML Entity Encoder and copy the result: the tool instantly escapes the five characters that have special meaning in HTML — & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot; and ' becomes &#39; — so browsers display them as literal text instead of interpreting them as markup. It runs entirely in your browser, free, with no sign-up, and leaves non-ASCII characters like é and © unchanged.

What HTML entity encoding does

HTML entity encoding replaces characters that HTML treats as code with safe text references. Without it, a browser reading <p> starts a paragraph; with encoding, &lt;p&gt; displays the four characters <p> on the page. Every entity starts with & and ends with ;. You need it whenever you show code samples, embed user text into a page, or paste markup into a field that would otherwise swallow it.

How to encode HTML entities with the Hellagape tool

  1. Open the HTML Entity Encoder. The input box loads with a sample (<div class="card">) — clear it or type over it.
  2. Paste or type your text into the "Input to convert" box.
  3. Read the RESULT panel — it updates instantly as you type. There is no Convert button to press (the page's generic how-to text mentions one, but the live tool converts on every keystroke).
  4. Click Copy to copy the encoded text, or Download to save it as a file.
  5. Paste the result into your HTML source wherever the characters must display literally.

Worked examples (verified on the live tool)

Example 1 — a tag with an ampersand and quotes. Input: <p>Hello & "world"</p> (22 characters) Output: &lt;p&gt;Hello &amp; &quot;world&quot;&lt;/p&gt; (48 characters) Each special character expands: < (1 char) → &lt; (4), & → &amp; (5), " → &quot; (6). The output is 48 ÷ 22 ≈ 2.2× the input length — normal for markup-heavy text.

Example 2 — maths text. Input: a < b && c > d (14 characters) Output: a &lt; b &amp;&amp; c &gt; d (28 characters) Note && becomes &amp;&amp; — each ampersand is escaped separately, which is exactly what you want: the browser renders && as text.

Example 3 — apostrophe. Input: It's "quoted" & <tagged> (24 characters) Output: It&#39;s &quot;quoted&quot; &amp; &lt;tagged&gt; (48 characters) The apostrophe encodes as the numeric entity &#39; (HTML has no universally supported named form for it in older doctypes, so numeric is the safe choice).

Example 4 — non-ASCII passes through. Input: Café © 2026 (11 characters) Output: Café © 2026 (11 characters, unchanged) The tool escapes only the five markup characters. Accented letters, symbols and emoji stay as-is, which is correct for UTF-8 pages — if you need pure-ASCII output for a legacy system, this single-mode tool is not the one for that job.

Entity reference

CharacterEncoded asType
&&amp;Named
<&lt;Named
>&gt;Named
"&quot;Named
'&#39;Numeric (decimal)

Tips and common mistakes

  • Encode & first (the tool does this for you). If you escape < to &lt; and then escape &, you get &amp;lt;, which displays as the literal text &lt;. Double-encoding is the most common entity bug.
  • Don't encode text twice. If your source already contains &lt;, running it through again produces &amp;lt;. Encode raw text once, at output time.
  • Entities are for HTML, not URLs. Inside a link address you need percent-encoding (%20, %26) — use the URL Encoder instead.
  • Encoding is not a complete security control. Escaping output for the context it lands in (HTML body, attribute, script, URL) is what matters; inside a <script> block, HTML entities do not protect you.
  • To reverse it, use the companion HTML Entity Decoder, which turns entities back into characters.

Most asked questions

Which characters does the Hellagape encoder escape? Exactly five: & → &amp;, < → &lt;, > → &gt;, " → &quot;, ' → &#39; (verified live 2026-12-02). Everything else, including é and ©, passes through unchanged.

Do I need to press a Convert button? No. The result updates instantly as you type ("Typing updates the result instantly. Nothing is sent anywhere."). The page's generic how-to mentions a Convert step, but no such button exists on the live tool.

Can I choose named, numeric or hex entities? Not in this tool — it has no mode selector. It outputs named entities for & < > " and numeric &#39; for the apostrophe. If you need hex or encode-all-non-ASCII output, use a multi-mode encoder instead.

Is my text sent to a server? No. The tool "processes everything locally with JavaScript" and closing the tab clears the data (page's own wording).

Why did my text get longer after encoding? Each escaped character expands to 4–6 characters (< → &lt;). Markup-heavy input roughly doubles in length — Example 1 above went from 22 to 48 characters.

What is the difference between &#39; and &apos;? Both mean the apostrophe. &apos; is defined in XML and HTML5, but older HTML4 parsers did not know it, so &#39; is the maximally compatible form — and the one this tool outputs.

How do I decode entities back to text? Paste the encoded text into the HTML Entity Decoder: &lt;p&gt; becomes <p> again.

When should I encode instead of just typing the character? Whenever the character must be seen rather than acted on: code samples, documentation, user-generated text rendered into a page, and attribute values containing quotes.

Try it now

HTML Entity Encoder

Escape characters such as < and & into safe HTML entities.

Open the free tool