</>

HTML Encoder/Decoder

Encode and decode HTML entities online for free. Convert special characters to HTML codes and vice versa. Safe for web use.

An HTML encoder replaces the characters that carry meaning in markup with their entity equivalents, so a browser prints them instead of running them. On the Encode tab with Named Entities selected, five characters change: & < > " and '. Encoding <p>Hello & World "quotes" 'apostrophe'</p> turns 42 characters into 76, and the stat strip reports 9 entities found and a size change of +81%.

Advertisement

HTML entity workspace

Encode HTML as literal text, decode entity references, inspect a restricted preview or search the symbol reference.

Method and limits

Named mode escapes &, <, >, double quotes and apostrophes. Decimal and hexadecimal modes also encode non-ASCII characters by Unicode code point. All-character mode encodes every code point. Decoding supports HTML named and numeric references while preserving literal tags.

Encoding HTML is not universal XSS protection: JavaScript, CSS and URL contexts need their own rules. Preview removes active content and resources. Malformed Unicode and NUL text are refused. There is no fixed text cap; browser memory still limits large drafts.

Processing happens in this browser; these converters do not upload your draft. Other site features can make requests.

Input length
Output length
Entities Found
Size change

Preview keeps basic text formatting only. Attributes, scripts, forms, embedded documents and external resources are removed. Images contribute their alternative text; links are not active. This is not a full web page preview.

HTML tags
Text content
Total size
🔍

Character Named entity Numeric entity Hex entity Description
No entities found

Copied

Copy failed. Select the result and copy it manually.

Embed this tool on your website

Use whole pixel dimensions from 1 to 4096.

× px (1–4096)

                        

💡 Integration Tip

Copy the embed code and paste it into your website HTML. The responsive version adapts to all screen sizes automatically.

4.0
3 ratings
✓

About HTML Encoder/Decoder

Encode HTML as literal text, decode entity references, inspect a restricted preview or search the symbol reference. Named mode escapes &, <, >, double quotes and apostrophes. Decimal and hexadecimal modes also encode non-ASCII characters by Unicode code point. All-character mode encodes every code point. Decoding supports HTML named and numeric references while preserving literal tags.

<b>A&B</b> becomes &lt;b&gt;A&amp;B&lt;/b&gt;. Decimal encoding of 😀 is &#128512;, which decodes back to 😀.

Encoding HTML is not universal XSS protection: JavaScript, CSS and URL contexts need their own rules. Preview removes active content and resources. Malformed Unicode and NUL text are refused. There is no fixed text cap; browser memory still limits large drafts.

Use Cases

<b>A&B</b> becomes &lt;b&gt;A&amp;B&lt;/b&gt;. Decimal encoding of 😀 is &#128512;, which decodes back to 😀.
Choose encode or decode and the entity style. Enter text, compare input and output, then swap or copy. Preview and reference are separate modes.

How to use

1

Choose encode or decode and the entity style. Enter text, compare input and output, then swap or copy. Preview and reference are separate modes.

2

<b>A&B</b> becomes &lt;b&gt;A&amp;B&lt;/b&gt;. Decimal encoding of 😀 is &#128512;, which decodes back to 😀.

Pro Tips

  • Encoding HTML is not universal XSS protection: JavaScript, CSS and URL contexts need their own rules. Preview removes active content and resources. Malformed Unicode and NUL text are refused. There is no fixed text cap; browser memory still limits large drafts.

Troubleshooting

Problem:

The output is identical to the input and Entities Found stays at 0.

Solution:

With Named Entities selected, only & < > " and ' are converted, so text without any of those five characters comes back unchanged. That is correct behaviour. If you need accented or non-Latin characters converted too, switch to Numeric Entities or Hex Entities.

Problem:

Decoding gives back text that still contains &amp; and &lt;.

Solution:

The source was double-encoded: the ampersand of each entity had itself been encoded before you received it. Press Decode a second time on the output, or use Swap and run the decode again, until the entities stop shrinking.

Problem:

Encoded output shows &#39; where I expected &apos;.

Solution:

That is deliberate. &apos; was introduced for XML and HTML5 and was never part of HTML 4, so this tool writes the numeric &#39; instead, which every browser and mail client renders correctly.

Problem:

The Size change counter jumps to several hundred per cent.

Solution:

The encoding type is set to All characters, which converts every character in the text to a numeric entity rather than only the five that matter in markup. Switch back to Named Entities unless you specifically want that obfuscation.

Frequently Asked Questions

Named mode escapes &, <, >, double quotes and apostrophes. Decimal and hexadecimal modes also encode non-ASCII characters by Unicode code point. All-character mode encodes every code point. Decoding supports HTML named and numeric references while preserving literal tags.

Encoding HTML is not universal XSS protection: JavaScript, CSS and URL contexts need their own rules. Preview removes active content and resources. Malformed Unicode and NUL text are refused. There is no fixed text cap; browser memory still limits large drafts.

Processing happens in this browser; these converters do not upload your draft. Other site features can make requests.

Popular Tools

No more tools to show
Explore All Tools
FreeWebTools AI