Coding Tool

HTML Encoder & Decoder

Convert special characters to HTML entities and decode them back. Named entities, numeric codes, live preview, 80+ entity support.


    
Input
Output
Entities
Characters
Output chars
Live HTML Preview

Entity Quick-Insert

Click any entity to append it to the input field. Useful for inserting special characters you don't have on your keyboard.

How to Use This Tool

Everything this HTML encoder and decoder does — and how to get the most out of each feature.

1
Encode HTML
Select Encode, paste any HTML or plain text. Characters like <, >, &, ", and ' are instantly converted to safe HTML entities.
2
Decode Entities
Switch to Decode, paste any HTML-encoded string. Named entities (&amp;), decimal (&#38;), and hex (&#x26;) codes are all resolved.
3
Tweak Options
Use Named entities for readable output (&copy;), Encode all non-ASCII for maximum compatibility, and toggle Encode quotes when working with HTML attributes.
4
Preview the Result
The Live Preview panel renders your input HTML so you can see exactly how it looks in a browser — alongside the encoded output.
5
Insert Special Chars
Use the Entity Quick-Insert table to add copyright signs, arrows, fractions, Greek letters, and other symbols you can't type directly.
6
Swap & Download
Swap flips the output back to input and reverses the mode — perfect for a round-trip check. Download the result as an HTML file anytime.

What's Built In

A complete HTML entity tool — no extensions, no accounts, no data ever leaving your browser.

🔤
80+ Named Entities
Covers all essential HTML5 named entities — symbols, accented letters, Greek alphabet, currencies, arrows, and math operators.
🔢
Numeric Code Decode
Decodes both decimal (&#169;) and hexadecimal (&#xA9;) numeric entities — any Unicode character, not just those with names.
🌍
Encode All Unicode
The "Encode all non-ASCII" option converts every character above code point 127 to a numeric entity — for maximum ASCII-safe output.
👁️
Live HTML Preview
See your HTML rendered in real time alongside the encoded output — so you know the markup is valid before copying it.
Real-Time Processing
Output updates as you type — no button needed. Ideal for spot-checking specific characters as you work through a document.
🔁
Swap Mode
One click moves output back to input and flips encode/decode — useful for verifying that a round-trip produces the original string.
📋
Quick-Insert Table
32 clickable entity tiles let you insert copyright, trademark, currency, arrows, fractions, and Greek letters without memorising the entity names.
🔒
100% In-Browser
All processing happens locally via JavaScript. Your HTML content — which may contain private data or unpublished code — never touches a server.

Frequently Asked Questions

Common questions about HTML encoding, entities, and how this tool works.

HTML encoding converts characters that have special meaning in HTML into entity sequences that are displayed as text instead of parsed as markup. For example, < becomes &lt; so the browser shows a literal less-than sign rather than treating it as the start of an HTML tag. This matters in two scenarios: security (preventing XSS attacks by neutralising injected markup) and correctness (displaying code snippets, math expressions, or special symbols in a web page).

The five characters with special HTML meaning are: &&amp;, <&lt;, >&gt;, "&quot;, and '&apos;. Of these, &, <, and > are critical everywhere. Quotes need encoding primarily inside HTML attribute values. Failing to encode any of these when inserting user-supplied content is a classic XSS vulnerability.

Named entities use a memorable shorthand — &copy; for ©, &amp; for &, &mdash; for —. Numeric entities use the Unicode code point in decimal (&#169;) or hex (&#xA9;) for the same ©. Both formats are valid HTML and render identically in all browsers. Named entities are easier to read in source code; numeric entities work for any Unicode character, even those without a named equivalent.

Yes — when applied correctly. HTML encoding neutralises injected HTML by converting < and > to &lt; and &gt;, preventing a browser from parsing attacker-controlled strings as tags or script elements. However, encoding alone is not sufficient in all contexts: JavaScript event handlers require JavaScript escaping, CSS values need CSS escaping, and URL parameters need URL encoding. The right encoding must match the context where the data appears.

Use &nbsp; (non-breaking space) when you need two words to stay on the same line and never wrap — for example, "10&nbsp;km", "Dr.&nbsp;Smith", or a number with its unit. The non-breaking space prevents the browser from inserting a line break at that position. For general paragraph spacing, use CSS margin or padding — adding multiple &nbsp; characters for visual indentation is a bad practice that affects accessibility and screen readers.

Yes. All encoding and decoding happens entirely inside your browser using JavaScript. Your HTML is never sent to any server, never stored, and never logged. You can safely paste confidential markup, internal template code, or HTML containing personal data without any risk of it being intercepted or stored externally.

Checking "Encode all non-ASCII" converts every character with a Unicode code point above 127 to a numeric entity (&#[number];). This produces a fully ASCII-safe output string — useful when the target system doesn't support UTF-8, when embedding HTML inside another encoding context, or when you need to ensure the output contains only the 128 basic ASCII characters. For normal HTML documents served with a UTF-8 charset, this option is unnecessary.

They serve different typographic purposes. The en dash (&ndash; –) is roughly the width of the letter N and is used for ranges (pages 10–20, 2020–2026) and to connect related items. The em dash (&mdash; —) is the width of the letter M and is used as a strong parenthetical break — like this — or to signal an interruption in speech. Neither should be confused with a hyphen (-), which is a keyboard character used for compound words and word breaks.

HTML encoding always increases the text length because single characters are replaced by multi-character sequences. The ampersand & (1 character) becomes &amp; (5 characters). The copyright symbol © (1 character) becomes &copy; (6 characters). This is expected — the longer encoded form is how the browser knows to display the character rather than parse it as markup. The rendered output looks identical to the original in a browser.

For symbols like ©, €, and em dash, you can write them directly in a UTF-8 HTML document and they display fine. The only characters you must always encode are <, >, and & — these must be entities regardless of the character encoding because the HTML parser treats them as markup delimiters. In attribute values, you also need to encode " or ' depending on which quote character delimits the attribute.

Related Tools

View all →

Related Articles

View all →