HTML Encoder / Decoder

Encode or decode HTML entities instantly in your browser. Escape special characters for safe display, or convert HTML entities back into readable text. Ideal for code snippets, debugging markup, and handling user input.

Clear
Text is processed entirely in your browser and is never uploaded to any server.

How to encode or decode HTML entities

Paste your text and choose Encode or Decode. Encoding turns special characters into HTML entities so they display safely; decoding turns entities back into normal characters. Everything runs locally in your browser.

Paste your text

Paste plain text, HTML, or entity-encoded content. Line breaks and multi-line input are preserved.

Choose Encode or Decode

Use the tabs to switch between encoding (text → entities) and decoding (entities → text). Output updates live as you type.

Copy the result

Copy the output for use in HTML, attributes, documentation, or anywhere you need escaped or unescaped text.

Example inputs and outputs

These examples show how the HTML encoder and decoder behave.

Encode: Tom & Jerry

Input:
Tom & Jerry

Output:
Tom & Jerry

The ampersand is escaped so it displays correctly in HTML.

Encode: HTML tag

Input:
<div class="note">Hello</div>

Output:
&lt;div class="note"&gt;Hello&lt;/div&gt;

Safe to show as text instead of rendering as HTML.

Decode: named entities

Input:
&lt;div&gt;Hello&lt;/div&gt;

Output:
<div>Hello</div>

Named entities are turned back into characters.

Encode: non-ASCII (option on)

Input:
François & ☕

Output:
Fran&#231;ois &amp; &#9749;

With “Encode non-ASCII” on, characters like ç and become numeric entities.

When to escape HTML or decode entities

HTML encoding replaces characters like &, <, and > with entity references so they display as text instead of being interpreted as HTML. Decoding does the reverse: it turns entity references back into normal characters.

Common use cases:

Display user input safely

Escape HTML before showing user-generated content to prevent XSS and broken layout when the text contains <, >, or &.

Show code or markup as text

Encode HTML tags and attributes so they appear as literal text in docs, comments, or code samples instead of rendering.

Decode copied content

Paste entity-encoded text from emails, logs, or CMS output and decode it back into readable characters.

Handle attributes and quoted text

Encode " and ' for safe use inside HTML attribute values.

Frequently asked questions

To encode HTML, paste your text into the tool and select “Encode.” Special characters like <, >, &, ", and ' are converted into HTML entities (e.g., &lt;, &gt;, &amp;). This prevents them from being interpreted as HTML and ensures they display correctly.
Paste the encoded string (such as &lt;div&gt;Hello&lt;/div&gt;) and select “Decode.” The tool converts HTML entities back into readable characters like <div>Hello</div>.
HTML encoding replaces characters like < and & with HTML entities so they display safely in web pages. URL encoding formats characters for use in URLs (e.g., spaces become %20). They serve different purposes and are not interchangeable.
Escape HTML when displaying user input, showing code examples, or inserting text into a webpage where characters like < or & could be interpreted as markup. This helps prevent rendering issues and security risks like XSS.
Your content has been HTML-encoded. Browsers display &lt; and &gt; as < and > to prevent them from being treated as actual HTML tags. If you want the original characters back, use the Decode function.
Yes. The tool supports named entities (&amp;), decimal entities (&#38;), and hexadecimal entities (&#x26;). All are correctly encoded and decoded.
Yes. Everything runs entirely in your browser. Your data is not uploaded or stored, so your input stays on your device.
At minimum: &, <, >, ", and '. These characters can affect how HTML is parsed. In some cases, non-ASCII characters (like é or emoji) may also be encoded for compatibility.