HomeToolsDeveloper Tools › HTML Entity Encoder / Decoder

HTML Entity Encoder / Decoder

Encode HTML special characters — <, >, &, ", ' — to safe HTML entities, or decode entities back to plain text. Instant client-side conversion. Common use cases: CMS content, email templates, code snippets. 100% in-browser, nothing stored.

All encoding and decoding runs in your browser. Your content is never uploaded or stored.
Encode scope:
Input 0 chars
Output 0 chars

About HTML Entity Encoder / Decoder

HTML Entity Encoder / Decoder converts between plain text and HTML entity notation instantly in your browser. Paste text in the INPUT panel and the encoded output appears in the OUTPUT panel with zero delay — no button click, no server round-trip, no data sent anywhere.

Encode mode

Two scopes are available. HTML-safe only encodes the five characters that break HTML structure: & < > " and '. The ampersand is encoded first to prevent double-encoding. This scope is the right choice for the vast majority of use cases — CMS content, code snippets, email template bodies, and API response values that will be rendered inside HTML.

All non-ASCII encodes the same five HTML-structural characters first, then additionally converts every character with a Unicode code point above U+007E (tilde) to a numeric HTML entity (&#charCode;). Use this scope when the target environment requires strict ASCII output — legacy email systems, certain CMS fields, or HTTP headers where non-ASCII bytes can cause encoding issues.

Decode mode

The decoder uses the browser's own HTML parser via the textarea trick: the encoded string is assigned to a textarea element's value property and read back as text. This handles all named entities (&nbsp;, &copy;, &euro;, &mdash;), numeric decimal entities (&#160;), and numeric hexadecimal entities (&#x00A9;) correctly and safely. No innerHTML assignment is used, so there is no risk of script execution when decoding content that contains <script> tags as entities.

Input limit

Input is capped at 100 KB. For larger documents, split the content into sections. All conversion happens synchronously in JavaScript — no background processing, no waiting.

Common use cases

Frequently asked questions

When should I use HTML-safe only vs. All non-ASCII?

HTML-safe only encodes the five characters that break HTML structure (< > & " '). This is correct for the vast majority of use cases. Use All non-ASCII when the target system requires strict 7-bit ASCII output — for example, legacy email clients that do not support multi-byte characters, or XML parsers with strict encoding requirements.

Does this tool handle named entities like &nbsp; and &copy;?

Yes, in Decode mode. The decoder uses the browser's native HTML parser, which resolves all named entities (including &nbsp;, &copy;, &euro;, &mdash;, and the full HTML5 named character reference list) correctly. Encode mode only produces named entities for the five HTML-structural characters and numeric entities for everything else.

Is it safe to decode content that contains <script> tags?

Yes. The decoder uses a textarea element trick (assigning the encoded string to textarea.value and reading back the plain text) rather than innerHTML assignment. The browser performs entity resolution without parsing or executing any HTML, so encoded script tags decode to plain text, not executable code.

Does this tool send my content to a server?

No. All encoding and decoding runs in JavaScript entirely within your browser. Nothing is uploaded or stored. You can encode sensitive content — API keys, passwords, private documents — without any data leaving your device.

What is the input size limit?

Input is capped at 100 KB (approximately 100,000 characters). For larger documents, split the content into sections and encode each section separately.

Keep going

More developer tools

LiveDeveloper

Base64 Encoder / Decoder

Encode binary or file content as Base64 for safe transport in data URIs, API payloads, or email templates — the encoding complement to HTML entity conversion.

Open tool
LiveDeveloper

URL Encoder / Decoder

Percent-encode URLs and query string values — use alongside HTML entity encoding when building safe links inside HTML attributes.

Open tool
LiveDeveloper

Binary Translator

Translate text to binary and back — covers the ASCII range that HTML-safe encoding also protects, useful for understanding character encoding at the byte level.

Open tool
LiveDeveloper

JSON Formatter & Validator

Format and validate JSON that may contain encoded HTML entities — confirm structure and entity values are correct before embedding in API responses or documentation.

Open tool