Quick Answer
- Open the NextUtils HTML Entity Converter (free, no sign-up).
- Paste your text or upload a file — up to 10 MB.
- Choose Encode or Decode and select the format: named, numeric, or XML.
- Copy the output or download it as a text file instantly.
Encode HTML Entities — Free
Convert special characters to named, numeric, or XML entity codes — or decode them back. Paste text or upload a file, get instant results. No sign-up.
Open HTML Entity Converter →Special characters like <, >, &, and " have reserved meaning in HTML. When you put them directly into markup, the browser misinterprets them — a bare < looks like the start of a tag, and a bare & breaks the parser. HTML entities are the standardised escape codes that let you represent these characters safely, as plain text the browser will render rather than interpret.
The NextUtils HTML Entity Converter handles encoding and decoding for any amount of text — paste a snippet or upload a file up to 10 MB. It supports three output formats (named, numeric, XML), optional encoding of spaces and newlines, and shows conversion statistics alongside the result. This guide explains what HTML entities are, when you need them, and how to use the tool for each common use case.
Advertisement
What Are HTML Entities?
An HTML entity is a text string that starts with an ampersand and ends with a semicolon, representing a single character. The HTML specification defines named entities for a large set of characters that are otherwise reserved, non-printable, or difficult to type. All other Unicode characters can be represented using numeric entities — either decimal or hexadecimal — regardless of whether a named form exists.
There are three encoding formats, each producing the same rendered output in a browser:
| Format | Example for & | When to use |
|---|---|---|
| Named | & | HTML5 pages — readable and widely supported for the defined character set |
| Numeric (decimal) | & | Any HTML document — works for every Unicode character, not just named ones |
| XML / XHTML | & | XML documents, RSS feeds, SVG, XHTML — uses only the five predefined XML entities; everything else uses numeric form |
Key rule: The five characters that always require encoding in HTML are & < > " ' — ampersand, less-than, greater-than, double quote, and apostrophe. Everything else is optional but harmless to encode.
Common HTML Entities Reference
These are the entities you will encounter most frequently in web development:
| Character | Named entity | Numeric entity | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less-than sign |
| > | > | > | Greater-than sign |
| " | " | " | Double quotation mark |
| ' | ' | ' | Apostrophe / single quote |
| |   | Non-breaking space | |
| © | © | © | Copyright symbol |
| ® | ® | ® | Registered trademark |
| ™ | ™ | ™ | Trademark symbol |
| — | — | — | Em dash |
When Do You Need to Encode HTML Entities?
Preventing XSS in user-generated content
The most critical use case is security. If your application displays user-submitted text — comments, forum posts, form fields — in an HTML page without encoding, an attacker can inject a <script> tag or an event attribute that executes in visitors' browsers. Encoding all user input before rendering it as HTML neutralises this attack by converting the angle brackets and quotes to inert entity codes that the browser displays as literal characters.
Displaying code in a web page
Whenever you show HTML, XML, or code samples on a page — in a blog post, documentation site, or code tutorial — the angle brackets in your examples must be encoded. Without encoding, the browser parses the code as actual markup instead of displaying it. This is why static site generators and Markdown renderers automatically encode code blocks before output.
HTML email templates
Email HTML is parsed by dozens of different clients — Outlook, Gmail, Apple Mail — with inconsistent HTML5 support. Many email clients have stricter parsers that break on unencoded reserved characters in attribute values or text nodes. Encoding special characters before inserting them into email templates improves rendering consistency across clients.
XML-based APIs and data feeds
REST APIs that return XML, RSS and Atom feeds, SOAP services, and SVG files all require valid XML. XML has a strict parser — any unescaped &, <, or > in text content makes the document invalid and unparse-able. Use the XML encoding mode when your output will be consumed by an XML parser rather than an HTML5 browser.
Note: Most modern web frameworks (React, Vue, Angular, Django, Rails) encode HTML entities automatically when you render dynamic content via templates or JSX. You only need manual encoding when you are directly building HTML strings, working with raw output functions, or processing text outside a framework context.
How to Encode HTML Entities — Step by Step
Step 1: Open the tool and add your text
Open the HTML Entity Converter — no sign-up required. Type or paste text into the input area on the left. For larger files, click the upload button and select a plain-text file up to 10 MB. The input accepts any character — plain text, HTML snippets, XML fragments, or mixed content.
Step 2: Select Encode or Decode
Choose Encode to convert special characters to entity codes, or Decode to convert entity codes back to the original characters. Use Decode when you receive HTML-escaped text from an API or database and need to extract readable content.
Step 3: Choose the entity format
Select the encoding type:
- HTML (named) — uses named entities where available (
&,©), numeric for the rest. Best for HTML5 pages. - Numeric — uses decimal code points (
&,©) for every character. Works universally. - XML — uses only the five XML predefined entities and numeric form for everything else. Use for XML documents, RSS, and SVG.
Optional settings let you encode spaces as and newlines as , or preserve the document's existing formatting.
Step 4: Copy or download the output
The converted output appears in the right panel instantly — no button to click. Copy the entire output to the clipboard with one click, or download it as a .txt file. The tool shows a conversion summary: how many characters were encoded, the input and output lengths, and a character count.
Frequently Asked Questions
What are HTML entities?
HTML entities are escape codes that represent characters reserved in HTML or otherwise difficult to type. They start with & and end with ; — for example, < for the less-than sign and © for the copyright symbol. The browser renders them as the actual character, not as markup.
When do I need to encode HTML entities?
You need encoding whenever you insert user-generated text into HTML (to prevent XSS), when displaying code examples on a page (so angle brackets show as characters, not tags), when building HTML email templates, and when producing XML-based output like RSS feeds or SVG where unencoded reserved characters make the document invalid.
What is the difference between named and numeric entities?
Named entities (&) use human-readable shorthand defined by the HTML specification. Numeric entities (&) use the Unicode code point in decimal or hex. Named entities exist only for a defined character set; numeric entities work for any Unicode character. Both render identically in browsers.
Why is there a separate XML encoding mode?
XML parsers are stricter than HTML5 browsers. In XML, only five named entities are predefined (& < > " '); all others must use numeric form. HTML named entities like © or are invalid in XML and will cause a parse error. Use XML mode for RSS feeds, SVG, XHTML, and any XML-based API output.
Can I decode entities back to plain text?
Yes — switch to Decode mode and paste or upload text containing entity codes. The tool converts named entities, decimal numeric entities, and hex numeric entities back to their original characters. This is useful when a CMS, database, or API returns double-encoded or escaped HTML and you need to extract readable text.
Do I need to encode every special character?
In modern HTML5, only the five reserved characters strictly require encoding: & < > " '. Other special characters — accented letters, emoji, currency symbols — can appear as literal UTF-8 characters in an HTML5 document with a charset=utf-8 declaration, though encoding them is harmless and occasionally required by older systems or strict XML parsers.
Encode HTML Entities — Free
Convert special characters to named, numeric, or XML entity codes — or decode them back to plain text. Paste text or upload a file, no sign-up required.
Open HTML Entity Converter →