HTML Entity Encoder / Decoder

Use this free HTML entity encoder and decoder to turn HTML characters into display-safe entity text or convert entity codes back to readable text.

All tools
Illustration for HTML Entity Encoder / Decoder showing encode HTML-sensitive characters or decode common named and numeric HTML entities.
HTML Entity Encoder / Decoder artwork matches the live tool workflow: encode HTML-sensitive characters or decode common named and numeric HTML entities. Use it with the calculator, examples, and result notes. View in the smoke-kawaii gallery
Inputs explained Result checks Example values Runs in your browser
Encoded entities
<strong>Free & fast</strong>

5 entities changed

Mode
encode
Input characters
28
Changed positions
43

Entity encoding helps display code examples as text. It is not a complete sanitizer for untrusted HTML.

Formula steps

  1. Find characters that need escaping in HTML text.
  2. Replace &, <, >, quotes, and apostrophes with entity text.
  3. Return copy-ready text without sending the snippet to a server.

How to use the HTML Entity Encoder / Decoder

  1. Choose Encode when you need HTML characters shown as text.
  2. Choose Decode when you need readable text from entity codes.
  3. Paste the snippet and press Run HTML entity tool.
  4. Treat entity encoding as display help, not a full security sanitizer.

What people use it for

Show HTML code examples inside a blog post, guide, or documentation page.

Decode copied entity text so it is easier to read.

Escape short snippets before placing them in visible HTML text.

Check whether a string changed after encoding or decoding.

Confirm whether numeric entities such as &#36; or &#x26; decode to the expected characters.

Quick examples

Encode tag text

<strong>Free & fast</strong>

5 entities changed from 28 input characters: &lt;strong&gt;Free &amp; fast&lt;/strong&gt;

Decode a quoted span

&lt;span title=&quot;A&amp;B&quot;&gt;Save&lt;/span&gt;

7 entities changed into readable HTML text: <span title="A&B">Save</span>

Quote cleanup

title="Calculator" data-label="A&B"

title=&quot;Calculator&quot; data-label=&quot;A&amp;B&quot;

Numeric entity decode

Price &#36;9.99 &#x26; no tracking

2 numeric entities changed: Price $9.99 & no tracking

Need the guide or a nearby tool?

Need a slower walkthrough, a related tool, or the full library? These links keep you close to the task you started.

Frequently asked questions

Plain-language answers about when to use the tool, what it does with your inputs, what to double-check, and how privacy works.

When should I use the HTML Entity Encoder / Decoder?

Use it when your task matches one of these common needs: Show HTML code examples inside a blog post, guide, or documentation page. Decode copied entity text so it is easier to read. It works best when you already know the text, code, URL, mode, format, or technical setting the page asks for.

What is the HTML Entity Encoder / Decoder doing with my inputs?

In plain language: Encode mode replaces &, <, >, double quotes, and apostrophes with &amp;, &lt;, &gt;, &quot;, and &apos;. Decode mode converts the supported named entities amp, apos, copy, gt, lt, nbsp, quot, and reg, plus valid decimal entities such as &#36; and hexadecimal entities such as &#x26;, back to characters. The examples on the page are there so you can compare your inputs with a filled-out example before copying the answer.

What do the main HTML Entity Encoder / Decoder inputs mean?

Encode characters mode: Use this when you want text such as <strong>Free & fast</strong> to show as visible code instead of being interpreted as HTML markup. Decode entities mode: Use this when copied text contains entity codes such as &lt;, &amp;, &quot;, &#36;, or &#x26; and you want to read the characters again. Entity count: The result counts how many characters or entity codes were converted. For example, <strong>Free & fast</strong> changes 5 entities when encoded. Changed positions: This is a quick difference check between input and output text. It helps confirm that encoding or decoding actually changed the snippet. Security boundary: Encoding helps display code as text. It does not validate HTML, remove unsafe scripts, or make untrusted user input safe to render as real markup.

How should I read the HTML Entity Encoder / Decoder answer?

Read the output next to your original input. If the tool changes format, units, encoding, spacing, or capitalization, compare a small sample before copying the whole result into another app.

What should I double-check before trusting the answer?

Entity encoding is useful for displaying code examples as text, but it is not a complete sanitizer for untrusted HTML or script content. Also check the selected mode, input format, encoding, and whether the text includes private keys, passwords, or sensitive data.

What characters does encode mode change?

Encode mode changes ampersands, less-than signs, greater-than signs, double quotes, and apostrophes. Those become &amp;, &lt;, &gt;, &quot;, and &apos; so the snippet can be shown as text in HTML.

Does this encode every possible symbol into an HTML entity?

No. It focuses on the characters that most often break visible HTML text or code examples. Regular letters, numbers, spaces, punctuation, and symbols that do not need escaping are left alone.

Can decode mode handle numeric entities?

Yes. Decode mode supports valid decimal entities such as &#36; and hexadecimal entities such as &#x26; when the code point is in the valid Unicode range.

Which named HTML entities are supported?

The compact decoder supports amp, apos, copy, gt, lt, nbsp, quot, and reg. Unknown named entities are left unchanged so you can spot text that needs a fuller entity reference.

Why does an ampersand become &amp; before other text?

Ampersands start entity codes in HTML. Encoding a plain ampersand first prevents text such as A&B from being confused with an entity-like sequence when the snippet is displayed.

Is HTML entity encoding the same as sanitizing HTML?

No. Entity encoding is useful for showing code examples as text. Sanitizing untrusted HTML is a separate security job that needs a maintained sanitizer and clear allowlist rules.

When should I use URL encoding instead?

Use URL encoding for query strings, path values, and links. Use HTML entity encoding for text that will be displayed inside HTML. The two formats solve different problems.

Does the site save what I enter?

No. The tool runs in your browser tab. Your recent answers stay only on the page while you use it, and they are not sent to a server.

Related tools