Skip to content
Text ↔ HTML entitiesDeveloper tools

HTML Entity Encoder / Decoder

Encode special characters as HTML entities (such as amp, lt and copy) or decode named and numeric entities back to text. Live result, one-click copy.

About this tool

About HTML Entity Encoder / Decoder

This HTML entity encoder and decoder converts characters to and from the codes HTML uses to show them safely. In HTML, the less-than sign starts a tag and the ampersand starts an entity, so to show those characters as text — for example to display a code sample on a web page, or to put a quote mark inside an attribute — they must be written as entities. An entity is an ampersand, a name and a semicolon; on this page we write just the name, so lt means an ampersand, then lt, then a semicolon. The five core ones are lt (less-than), gt (greater-than), amp (ampersand), quot (double quote) and the numeric entity #39 (apostrophe). Choose Encode and paste your text: those five characters are converted, along with common symbols such as © (copy), ® (reg), ™ (trade), € (euro), £ (pound), ° (deg), × (times), ½ (frac12) and the non-breaking space (nbsp). Encode also converts ASCII punctuation such as ! # $ % * + , . / : ; = ? @ [ ] { } | ~ to their HTML5 names (excl, num, comma, period and so on). That makes the output very safe to paste anywhere in HTML, but longer; it is valid in HTML5 pages, though older HTML4 and XML parsers do not know those newer names. Letters, digits, accented letters and other Unicode characters are left unchanged, which is fine for any page saved as UTF-8. Choose Decode to go the other way. It turns every named entity HTML defines back into its character, including mdash, hellip and rsquo, and it decodes numeric entities in both forms, decimal (#8377 for ₹) and hexadecimal (#x20B9 for the same sign). A code that is not a real entity is left as it is. The result updates as you type and Copy puts it on your clipboard. Everything runs in your browser. A note on security: encoding the five core characters is what stops user-entered text from being run as HTML, but in real applications escaping should be done by your template engine or framework at output time, not by hand.

HTML Entity Encoder / Decoder tool

When you need HTML entities

Show characters, not markup

Show code on a web page

An HTML snippet in a blog post would otherwise render.

ExampleEncode a div tag so readers see the tag itself instead of a box.

Symbols in templates

Old systems and some email tools mangle raw symbols.

ExampleWrite the © in an email footer as the copy entity.

Read encoded text

Exports and APIs often return quot and #39 entities.

ExampleDecode a product title from a feed back to “Men’s Shoes”.

Quotes in attributes

A " inside an attribute value ends it early.

ExampleUse the quot entity for the inch sign in a 5-inch screen label.

Clean database exports

Text saved through a CMS may be stored encoded.

ExampleDecode a CSV column of WordPress titles before analysis.

Learning HTML

See exactly which characters need escaping.

ExampleEncode a paragraph and compare it with the original.

Entity tips

Escape the right amount

Five characters are enough

For text inside HTML, only the ampersand, less-than, greater-than and the two quote marks must be escaped. The extra punctuation names are optional.

Watch double encoding

An entity that starts with amp twice means the text was encoded twice. Decode until it reads normally, then encode once.

Misspelled names stay

Decode leaves a code that is not a real entity as it is, so a typo is easy to spot in the result.

UTF-8 makes it simple

In a UTF-8 page you can type ₹, é or हिंदी directly; no entity needed.

Building a URL?

Links need percent-encoding, not entities.

Open URL Encoder

Unicode escapes for code

For \u20B9 style escapes in JavaScript or JSON, use the Unicode converter.

Open Unicode Converter
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed HTML Entity Encoder / Decoder and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 24 November 2026

Answers and guidanceFrequently Asked Questions
What are HTML entities?
Codes that start with an ampersand, end with a semicolon and stand for a character: lt for the less-than sign, or copy for ©. They let you show characters that HTML would otherwise treat as markup.
Which characters must be encoded in HTML?
Inside text and attributes: the ampersand, less-than, greater-than, double quote and apostrophe. This tool encodes those and many symbols and punctuation marks too.
Why is my comma encoded as an entity?
Encode converts ASCII punctuation to HTML5 named entities as well. It is valid HTML5 and safe, just longer. Older XML or HTML4 tools may not recognise those names.
Does it decode numeric entities?
Yes, both decimal (#169) and hexadecimal (#xA9) forms, both giving ©.
Which named entities can it decode?
Every named entity HTML defines, including less common ones such as mdash, hellip and rsquo. A code that is not a real entity is left unchanged.
Are accented letters encoded?
No. Letters such as é or ñ and other Unicode characters are left as they are, which displays correctly on any UTF-8 page.
Does encoding protect against XSS?
Escaping those five core characters is the basis of output encoding, but in an app let your framework escape output automatically rather than relying on manual encoding.
More tools for your workflowRelated Tools

URL Encode / Decode

Percent-encode text for URLs or decode %20-style links. Component, Full URL and Form data modes, line by line, with URL parts and editable parameters.

Unicode Escape Converter

Convert text to Unicode escapes (\uXXXX, \u{…}, U+, &#x…;) and decode any escape back to readable text. See every character’s code point and UTF-8 bytes.

Base64 Encode/Decode

Encode text or files to Base64 and decode Base64 back to text, images or files. UTF-8 safe, URL-safe option, data URIs, all in your browser.

HTML Formatter

Beautify messy or minified HTML with clean indentation. Indent 2, 4 or 8 spaces, line wrapping, inline scripts and styles indented too.

1 / 3
Browse all developer tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.