HTML entity converter
Encode special characters like <, >, & and quotes into HTML entities, or decode entities back to text. Safely show code on web pages. Free converter.
Encode and decode HTML entities
Some characters have special meaning in HTML. A < starts a tag and an & starts an entity, so if you want to display them as text, you write them as HTML entities: <, >, &, " and '. Entities can also represent symbols like © (©) and accented letters.
Choose Encode to turn special characters into entities, for example to show a code sample on a web page. Choose Decode to turn entities back into normal characters, for example when text from a feed or database is full of & and ’.
Encoding output is also a basic defence against HTML injection when you display user-supplied text.
How to use the html entity converter
- Paste the text or HTML.
- Choose Encode or Decode.
- Submit to convert.
- Copy the result.
Examples
Encoding a code sample
Input: <a href="/x">Tom & Jerry</a>
Output: <a href="/x">Tom & Jerry</a>
Paste this into a page and visitors see the code instead of a link.
Accents and symbols
Input: café © 2026
Output: café © 2026
Characters with named entities are converted too.
Apostrophes
Input: it's
Output: it's
Decoding
Input: © 2026 — café <b> €5
Output: © 2026 — café <b> €5
Named entities (©) and numeric ones (€) both decode.
Common uses
- Displaying HTML or code snippets on a web page or blog post.
- Cleaning text from RSS feeds, APIs or databases that contain entities.
- Escaping user-generated text before inserting it into HTML.
- Writing special symbols in HTML emails.
- Fixing double-encoded text like
&amp;. - Showing HTML or XML code examples in a blog post or documentation.
Tips and things to know
- If you see
&on a page, the text was encoded twice; decode once to fix it. - In modern UTF-8 pages, you only strictly need to encode
<,>,&and quotes in attributes. Other characters can be typed directly. - Escaping alone isn't a full security solution. Use your framework's built-in output escaping.
- To strip tags completely instead, use the HTML tags remover. For character codes, try the decimal converter.
Edge cases and limitations
- decodes to a non-breaking space, which looks like a normal space but behaves differently in code and spreadsheets.
- Encoding text that's already encoded turns & into &. Decode first if you're not sure.
- Emoji aren't converted to entities; they stay as they are, which is fine in UTF-8 pages.
Frequently asked questions
What is an HTML entity?
A text code that represents a character in HTML, written as &name; or &#number;, such as < for <.
Why do I need to encode < and >?
Browsers treat them as the start and end of tags. Encoding them makes the browser display them as characters.
What does mean?
A non-breaking space, which keeps two words on the same line and isn't collapsed like normal spaces.
Why does my text show ' or "?
The text was encoded for HTML but is being displayed somewhere that doesn't decode it. Decode it here.
Should I encode accented letters?
Not on modern UTF-8 pages: café displays fine as it is. Encoding is mainly needed for <, >, & and quotes.
Related tools
- HTML tags remover: Easily remove all HTML tags from a block of text.
- HTML minifier: Minify your HTML by removing all the unnecessary characters.
- Markdown to HTML: Convert markdown snippets to raw HTML code.
- BBCode to HTML: Convert forum type bbcode snippets to raw HTML code.
- URL encoder: Encode any string input to URL format.
Popular free tools
Convert text to UPPERCASE, lowercase, Sentence case, Capital Case, camelCase, PascalCase, snake_case, CONSTANT_CASE, dot.case or param-case. Free.
Look up the DNS records of any domain: A, AAAA, CNAME, MX, NS, TXT and SOA. Check email, SPF, verification and nameserver settings for free.
Create strong, random passwords in one click. Pick the length and include uppercase, lowercase, numbers and symbols. Free, no signup.
Encode any text or string to Base64 instantly. Useful for data URIs, HTTP Basic auth headers, email and APIs. Free online Base64 encoder.
Convert numbers into words, such as 1,250 to “one thousand two hundred fifty”. Write checks, invoices, legal documents and lessons correctly. Free.
Turn normal text into elegant 𝓬𝓾𝓻𝓼𝓲𝓿𝓮 letters you can copy and paste into Instagram, TikTok, X and Discord bios, captions and names. Free.