Online HTML Encode / Decode Tool

Convert special characters to HTML entities, or turn entities back into plain text.

HTML Encode & Decode

HTML Encode/Decode tool converts characters like <, >, &, " and ' into their safe HTML entity forms (and back).
It helps display those characters and entities as text instead of being parsed as markup.
This is a handy tool for every web developer and content creator.


Load an example

Copy Download
Input: 0 characters | Output: 0 characters
Ready to encode or decode HTML.


Introduction:

Our HTML Encode / Decode tool is a simple, browser-based utility that converts special characters into their HTML entity equivalents and reverses the process when you need the original text back. Encoding replaces characters such as <, >, &, " and ' with entities like &lt;, &gt;, &amp;, &quot; and &#039;.

Decoding does the opposite, turning those entities back into readable characters. This is useful whenever you want characters to appear as literal text on a web page instead of being interpreted as HTML tags, or when you need to clean up user-generated content before displaying it.


What This Tool Does?

Encode HTML: Converts the five characters that have special meaning in HTML (&, <, >, ", ') into their named or numeric entities so they display as plain text.

Example: The input Tom & Jerry <tag> becomes Tom &amp; Jerry &lt;tag&gt;.

Decode HTML: Reverses encoding by converting entities back into their original characters. It handles named entities like &amp; and numeric references like &#039; or &#x1F600;.

Example: The input Tom &amp; Jerry becomes Tom & Jerry.

Encode All Non-ASCII (Optional): When the checkbox is enabled, every character outside the basic ASCII range (accented letters, emoji, symbols) is also turned into a numeric entity such as &#x1F600;.

Example: The input café 😀 becomes caf&#xE9; &#x1F600;.

File Upload & Example Loader: Load a .txt or .html file into the input, or click "Load an example" to see the tool in action.

Copy & Download: Send the result to your clipboard with one click, or download it as a .txt file.

Live Statistics: Input and output character counts update as you type, so you can see how encoding changes the length of your text.


How to Use This Tool?

1. Enter your text: Type or paste text into the Input Text box, or upload a .txt / .html file.

2. Choose an option (optional): Tick "Encode all non-ASCII characters" if you also want accented letters and emoji converted to numeric entities.

3. Encode or Decode: Click "Encode HTML" to convert special characters into entities, or "Decode HTML" to turn entities back into plain text. The result appears in the Output Text box.

4. Copy or download: Use the Copy link to copy the result, or Download to save it as a file. Click Clear All to start over.


Examples:

Click Try it on any example below to load it straight into the Input Text box. The text on the right of each example is what Encode HTML produces from that input. Press Encode HTML or Decode HTML to see the result in the Output box.

Example 1: HTML tags in a paragraph
Input
<div class="note">
  <p>Hello & welcome to our <strong>newsletter</strong>.</p>
  <p>Visit our <a href="https://example.com">site</a> for more.</p>
</div>
Output (encoded)
&lt;div class=&quot;note&quot;&gt;
  &lt;p&gt;Hello &amp; welcome to our &lt;strong&gt;newsletter&lt;/strong&gt;.&lt;/p&gt;
  &lt;p&gt;Visit our &lt;a href=&quot;https://example.com&quot;&gt;site&lt;/a&gt; for more.&lt;/p&gt;
&lt;/div&gt;
Example 2: Quotes & apostrophes
Input
Tom & Jerry's "famous" cat loves "cheese" and Jerry's "mouse".
He said, "It's the best day ever!"
Output (encoded)
Tom &amp; Jerry&#039;s &quot;famous&quot; cat loves &quot;cheese&quot; and Jerry&#039;s &quot;mouse&quot;.
He said, &quot;It&#039;s the best day ever!&quot;
Example 3: Accented letters & emoji
Input
Café ☕ & croissant make a perfect French breakfast.
A naïve résumé with rocket emoji and pâté.
Output (encoded)
Caf&eacute; &#x2615; &amp; croissant make a perfect French breakfast.
A na&iuml;ve r&eacute;sum&eacute; with rocket emoji and p&acirc;t&eacute;.
Example 4: Symbols & copyright
Input
© 2026 TextToolz — all rights reserved.
Prices: €10, §3.5, alpha beta; rating star, 100% guaranteed.
Output (encoded)
&copy; 2026 TextToolz &mdash; all rights reserved.
Prices: &euro;10, &sect;3.5, alpha beta; rating star, 100% guaranteed.
Example 5: Mixed markup
Input
<p>Title: A < B & C > D "quote" 'end'</p>
<div data-x="1 > 0">Tom & Jerry's "show"</div>
Output (encoded)
&lt;p&gt;Title: A &lt; B &amp; C &gt; D &quot;quote&quot; &#039;end&#039;&lt;/p&gt;
&lt;div data-x=&quot;1 &gt; 0&quot;&gt;Tom &amp; Jerry&#039;s &quot;show&quot;&lt;/div&gt;
Example 6: Full HTML document (10+ lines)
Input
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Demo & "Test" Page</title>
  <meta charset="UTF-8">
</head>
<body>
  <h1>Welcome to <b>TextToolz</b></h1>
  <p>A & B < C > D 'quote' "double"</p>
  <ul><li>Item & more</li></ul>
</body>
</html>
Output (encoded)
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Demo &amp; &quot;Test&quot; Page&lt;/title&gt;
  &lt;meta charset=&quot;UTF-8&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;h1&gt;Welcome to &lt;b&gt;TextToolz&lt;/b&gt;&lt;/h1&gt;
  &lt;p&gt;A &amp; B &lt; C &gt; D &#039;quote&#039; &quot;double&quot;&lt;/p&gt;
  &lt;ul&gt;&lt;li&gt;Item &amp; more&lt;/li&gt;&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;

When to Use This Tool?

Displaying Code Snippets & Documentation: When you write tutorials, blog posts or documentation, you often need to show markup such as <div> or <a href> on the page without the browser turning it into a live, clickable element. Encoding converts those characters into harmless entities so the source code is visible to readers exactly as written.

Preventing Cross-Site Scripting (XSS): Any time you echo user-submitted content back into a page, a clever visitor could paste <script> or <img onerror=...>. Encoding that content first means characters like < and > can never be interpreted as real tags or executable scripts, keeping your site and its visitors safe.

Safe Emails, Attributes & Feeds: Special characters such as &, quotes and non-Latin symbols can break HTML attributes (for example alt="Tom & Jerry"), email bodies and RSS/Atom feeds. Encoding them produces valid entities that survive transport and render correctly everywhere.

Cleaning & Normalising Pasted Content: Text copied from rich editors or other websites often arrives as double-encoded entities (for example &amp;amp;) or with stray markup. Use Decode to collapse those entities back into readable characters, then re-encode cleanly if you need consistent, standards-compliant output.

Supporting Non-ASCII & International Text: With the "Encode all non-ASCII characters" option, accented letters, emoji and symbols become numeric entities (e.g. &#xE9;), which is ideal when your output must stay inside a strict ASCII-only pipeline or legacy system.


FAQs:

FAQ 1: What is HTML encoding?
Answer: HTML encoding replaces special characters with entity codes so they are displayed as literal text rather than interpreted as HTML markup.

FAQ 2: When should I use HTML encoding?
Answer: Use it when you need to display user-generated content safely, embed code snippets in web pages, prepare strings for HTML attributes, or reduce cross-site scripting (XSS) risks.

FAQ 3: What characters are encoded by default?
Answer: The tool encodes &, <, >, " and ' by default, because these are the characters that have special meaning in HTML.

FAQ 4: What does the "Encode all non-ASCII characters" option do?
Answer: When checked, any character outside the standard ASCII range (code points 128 and above) is converted to a numeric HTML entity, for example &#x1F600; for the 😀 emoji. This keeps even accented letters and emoji safe in ASCII-only environments.

FAQ 5: Can I decode previously encoded text?
Answer: Yes. Paste the encoded string into the input area and click Decode HTML to revert it to the original characters, including named and numeric entities.

FAQ 6: Is the tool free to use?
Answer: Absolutely. The HTML Encode / Decode tool, like every tool on text-toolz.com, is free and requires no registration.

TextToolz

The Ultimate Text Tools

TextToolz works seamlessly to let you convert and design your text. It is fast, reliable and secure. Trusted by thousands of users.