Skip to content
ToolZone

HTML Encoder/Decoder

Convert special characters in text to their HTML entity equivalents, or decode existing entities back into readable text for safe embedding in HTML.

Runs in your browser. Nothing you enter or upload leaves your device.

Encode
Style
Result appears here

Encoding the five special characters is enough to show code safely inside HTML. Encode non-ASCII when a page or email can’t be saved as UTF-8.

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the HTML Encoder/Decoder

The HTML Encoder/Decoder switches text between raw characters and HTML entities. Encode turns markup-sensitive characters into safe entities so they display as text, and Decode turns entities like & or © back into the characters they stand for.

How it works

Encode always replaces the five special characters: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and an apostrophe becomes &#39;. With Also non-ASCII, every character beyond basic ASCII (accents, symbols, emoji) is encoded too, and Every character encodes all non-whitespace characters. Common characters such as © and — get named entities in Named style; everything else uses decimal or hex numeric entities.

Decode uses the browser's own HTML parser: the text is placed into a hidden textarea element as HTML and read back as plain text. That means every entity the browser knows is decoded, including named ones like &copy; and &eacute;, and numeric ones like &#8364; or &#x20AC;.

How to use

  1. 1

    Choose Encode or Decode.

  2. 2

    Paste your HTML or entity-filled text into the box.

  3. 3

    When encoding, choose what to encode and the entity style.

  4. 4

    Review the result and click Copy.

Worked examples

Showing code on a page

Displaying a link tag inside a tutorial.

Input
<a href="/docs">Docs & Help</a>
Result
&lt;a href=&quot;/docs&quot;&gt;Docs &amp; Help&lt;/a&gt;

Decoding a feed title

Cleaning text from an RSS feed.

Input
Tom &amp; Jerry&#39;s &quot;Best&quot; &copy; 2024
Result
Tom & Jerry's "Best" © 2024
Limitations
Decode runs input through the browser's parser, so any HTML tags in the input are stripped from the output rather than shown. Named style uses names only for about 25 common characters; others fall back to numeric entities.
Assumptions
The output will be used in a UTF-8 HTML document.
Privacy
All conversion happens in your browser; nothing you paste is uploaded.

Frequently asked questions

Why would I need to encode text for HTML?+

Characters like < and > start and end tags, so encoding them as &lt; and &gt; makes the browser display them as text instead of treating them as markup.

What does &amp; mean?+

It is the HTML entity for an ampersand. The & must be escaped because it starts every other entity.

Does Encode convert accented letters like é?+

Only if you choose Also non-ASCII or Every character. By default only &, <, >, " and ' are converted, because accented letters are valid as-is in UTF-8 pages.

Which entities can Decode handle?+

Any entity the browser recognizes, including named entities like &copy; and numeric ones like &#169; or &#xA9;.

Related tools