HTML entity converter

Encode special characters for safe HTML display

Overview

The HTML Entity Converter transforms special characters into HTML entities (encode) and converts HTML entities back to readable text (decode). Essential for web developers who need to safely display text on web pages, especially user-generated content that might contain characters like < > & that could break HTML or cause security vulnerabilities.

Two conversion modes
Text → Entities (encode) and Entities → Text (decode)
XSS protection
Prevent cross-site scripting by encoding user input
Entity reference
Built-in searchable reference table with 100+ entities
Real-time conversion
Auto-convert as you type with instant results

Interface layout

The HTML Entity Converter has a clean, two-panel layout with mode selection at the top. Here's what you'll see when you open the tool:

1

Conversion mode selector (top)

At the top, you'll find the Conversion mode panel (collapsible with a chevron icon) containing two mode buttons:
Text → Entities: Encode special characters - converts plain text to HTML entities
Entities → Text: Decode to plain text - converts HTML entities back to readable text

Click a mode button to switch between encoding and decoding.

2

Input panel (left side)

The left panel is for entering your input. The label changes based on mode:
In Text → Entities mode - Input text
In Entities → Text mode - HTML Entities

Header buttons (top right of panel):
Upload (cloud upload icon) - upload a file to convert
Paste (clipboard icon) - paste from clipboard
Clear (red trash icon) - clear all input

Drop zone:
Drag and drop files or click to type
Supported formats shown: TXT, HTML, JSON, XML

3

Convert button & Swap (center)

Between the two panels:
CONVERT (large orange button) - click to perform the conversion
Swap (↔ icon below) - swap input and output content

4

Output panel (right side)

The right panel displays conversion results. The label changes based on mode -
In Text → Entities mode - Encoded output
In Entities → Text mode - Decoded text

Header buttons (top right of panel):
Copy (clipboard icon) - copy result to clipboard
Download (download icon) - open export modal

5

Options bar (bottom left)

Below the panels, you'll find checkbox options. These differ by mode -

Text → Entities mode:
Auto-convert
Sync scroll
Named entities

Entities → Text mode:
Auto-convert
Sync scroll

Note: "Named entities" option only appears in Text → Entities mode

6

Statistics (bottom right)

Three counters track your conversion:
CHARS: total characters in input
ENTITIES: number of HTML entities found/created
CONVERTED (orange) - conversion percentage

7

Favorites (top right)

The heart icon in the top right corner lets you add this tool to your favorites for quick access from the homepage.

HTML Entity Converter interface showing mode selector, input/output panels, and statistics
HTML Entity Converter interface layout
8

HTML Entity reference (below main interface)

Scroll down to find the HTML Entity reference section - a searchable table of common HTML entities organized by category. This is a built-in cheat sheet for quick entity lookup. Click any entity card to copy it to your clipboard.

HTML Entity reference table with searchable categories
HTML Entity reference section

Text → Entities mode Encode

The Text → Entities mode converts regular text into HTML-safe entities. This is the encoding direction - use it when preparing text for HTML display.

1

When to use this mode

Use Text → Entities when:
Preparing user-generated content for web display
Writing code examples that should show as text, not execute
Adding special characters to HTML (©, ™, €)
Sanitizing input to prevent XSS attacks
Embedding quotes or angle brackets in HTML attributes

2

How it works

The encoder scans your text and replaces characters that have special meaning in HTML:
< becomes &lt;
> becomes &gt;
& becomes &amp;
" becomes &quot;
' becomes &#39; or &apos;

Special characters like © become &copy; (if Named entities is on) or &#169; (numeric).

3

Named entities option

When Named entities checkbox is checked (only available in this mode):
Common symbols use readable names: &copy;, &euro;, &trade;
Easier to read and edit in source code

When unchecked:
Uses numeric codes: &#169;, &#8364;, &#8482;
Works universally with all characters

4

Input panel label

In this mode, the left panel is labeled Input text: enter your plain text here that needs to be encoded for HTML.

Input panel showing 'Input text' label in Text to Entities mode
Input panel label in encode mode
5

Output panel label

The right panel is labeled Encoded output: this shows your text converted to HTML entities, ready to copy into your HTML source code.

Output panel showing 'Encoded output' label in Text to Entities mode
Output panel label in encode mode
Security best practice
ALWAYS encode user-generated content before displaying it on web pages. This prevents XSS (Cross-Site Scripting) attacks where malicious scripts could be injected through form inputs, comments, or URLs.

Entities → Text mode Decode

The Entities → Text mode converts HTML entities back to readable plain text. This is the decoding direction - use it when you need to read or edit encoded content.

1

When to use this mode

Use Entities → Text when:
Reading HTML source code with many entities
Editing content that was previously encoded
Extracting text from HTML for other purposes
Debugging entity encoding issues
Converting encoded emails or documents back to readable form

2

How it works

The decoder recognizes all entity formats and converts them to actual characters:
&lt; becomes <
&gt; becomes >
&amp; becomes &
&copy; becomes ©
&#8364; becomes
&#x20AC; becomes

All three formats (named, decimal, hex) are fully supported.

3

No Named entities option

Notice that the Named entities checkbox is NOT available in decode mode. This option only makes sense when encoding (choosing between &copy; and &#169;). When decoding, both formats produce the same © character.

4

Input panel label

In this mode, the left panel is labeled HTML Entities: enter your encoded text containing entities like &amp;, &lt;, &#169; here.

Input panel showing 'HTML Entities' label in Entities to Text mode
Input panel label in decode mode
5

Output panel label

The right panel is labeled Decoded text: this shows the readable plain text after converting all entities to their actual characters.

Output panel showing 'Decoded text' label in Entities to Text mode
Output panel label in decode mode
Double encoding issue
Sometimes text gets encoded multiple times. If you see &amp;lt; instead of &lt;, or &amp;amp; instead of &amp;, the text was double-encoded. You may need to decode twice to get the original text.

How to convert

Converting between text and HTML entities is simple. Follow these steps for a successful conversion:

1

Select conversion mode

Click the appropriate mode button in the Conversion mode panel:
Text → Entities: to encode text for HTML
Entities → Text: to decode entities to readable text

The active mode is visually highlighted.

2

Enter your input

You have three ways to add input:
Type directly: click in the input area and type or paste
Upload a file: click the upload icon or drag & drop a file (TXT, HTML, JSON, XML)
Paste from clipboard: click the paste icon

3

Conversion happens

If Auto-convert is enabled (default), conversion happens instantly as you type or paste.
If Auto-convert is off, click the CONVERT button to process your input.

4

Copy or download result

Once you have your result:
Click the Copy icon on the output panel to copy to clipboard
Click the Download icon to open the export modal with more options

A notification confirms successful actions.

5

Swap if needed

Made a mistake? Click the Swap button (⇄) between the panels to exchange input and output. This is useful for quick back-and-forth conversions or to reverse your work.

Swap button between input and output panels
Swap button for quick back-and-forth conversions

Input panel actions

The input panel (left side) has several action buttons in its header. Here's what each button does:

1

Upload button

Click the cloud upload icon to open a file picker. Select a file to load its contents into the input area.

Supported formats:
TXT - Plain text files
HTML - HTML documents
JSON - JSON data files
XML - XML documents

You can also drag and drop files directly onto the drop zone.

2

Paste button

Click the clipboard icon to paste content from your clipboard directly into the input area. This is equivalent to Ctrl+V / ⌘+V but works with a single click.

Useful when you've copied text from another application and want to quickly convert it.

3

Clear button

Click the red trash icon to instantly clear all content from the input area. This also clears the output and resets the statistics counters.

Use this to start fresh with a new conversion.

Input panel action buttons including clear button
Input panel action buttons
4

Drop zone

The main input area shows Drop files here or start typing when empty. You can:
Click anywhere in the area to start typing
Drag a file from your desktop and drop it here
The format badges (TXT, HTML, JSON, XML) indicate supported file types

Input panel drop zone with format badges
Drop zone with supported file formats

Output panel actions

The output panel (right side) displays your conversion results and provides options to use them. Here's what each button does:

1

Copy button

Click the clipboard icon to copy the entire output to your clipboard. A notification confirms the copy was successful.

The copied content is ready to paste into your HTML editor, code file, or any other application.

2

Download button

Click the download icon to open the Export modal with multiple export options:
Download as TXT or HTML file
Copy results to clipboard
Get a shareable link

See the Export modal section for full details.

Output panel action buttons
Output panel action buttons
3

Output display

The output area shows "Result will appear here..." when empty. After conversion:
Encoded entities appear in the Text → Entities mode
Decoded plain text appears in Entities → Text mode

The output is read-only but fully selectable for manual copying.

Output panel with conversion result
Output panel showing conversion result

Conversion options

Below the input/output panels, you'll find checkbox options that control how the conversion behaves. Note that available options differ by mode.

1

Auto-convert

When checked (default) - Conversion happens automatically as you type or paste. Every keystroke updates the output in real-time.

When unchecked: You must click the CONVERT button to process your input. Useful for very large inputs where real-time conversion might be slow.

Available in both modes.

2

Sync scroll

When checked (default) - Scrolling in one panel automatically scrolls the other panel to the same position. This helps you compare input and output side-by-side.

When unchecked: Each panel scrolls independently.

Available in both modes.

3

Highlight changes

When checked: Converted characters are highlighted in the output, making it easy to see exactly what was encoded or decoded.

When unchecked: Output appears without highlighting.

Available in Text → Entities mode only! Helps you quickly identify which characters required conversion.

4

Named entities

When checked: Uses readable entity names where available (&copy;, &euro;, &trade;). Easier to read and maintain in source code.

When unchecked: Uses numeric codes only (&#169;, &#8364;, &#8482;). Works with any character, including those without named entities.

Available in Text → Entities mode only! This option does not appear in decode mode.

Conversion options checkboxes
Conversion options with Named entities checkbox
Named vs Numeric
Named entities (&copy;) are human-readable and great for common symbols. Numeric entities (&#169;) are more universal - they work for any Unicode character, even obscure ones without official names.

Export modal Export

Click the Download button on the output panel to open the Export modal. This provides multiple ways to save and share your converted content.

1

Export as file

Download your results as a file:
TXT: Plain text file, universal compatibility
HTML: HTML file with proper encoding, ready for web use

Click a button to instantly download the file to your device.

2

Copy to clipboard

COPY RESULTS: Click to copy the entire output to your clipboard. Same as the copy button on the output panel, but accessible from the modal.

A notification confirms the successful copy.

3

Share

COPY SHARE LINK: Creates a shareable URL that contains your input text encoded in the link. When someone opens this link, they'll see the tool with your content pre-loaded.

Perfect for sharing examples with teammates or asking for help online.

4

Close modal

Click the X button in the top right corner to close the export modal and return to the main interface.

Export modal with download and share options
Export modal with all options

HTML Entity reference Built-in

Scroll down below the main converter to find the HTML Entity reference: a comprehensive, searchable table of common HTML entities. This is your built-in cheat sheet for quick entity lookup.

1

Search bar

At the top of the reference section, type in the search bar to find entities:
Search by character: type © to find the copyright symbol
Search by entity name: type "copy" or "amp"
Search by description: type "arrow" or "quote"

Results filter in real-time as you type.

2

Category tabs

Filter entities by category using the tab buttons:
ALL: show all entities (highlighted when active)
COMMON: frequently used entities (< > & " ' etc.)
SYMBOLS: miscellaneous symbols (© ® ™ § ¶ etc.)
ARROWS: directional arrows (← → ↑ ↓ etc.)
MATH: mathematical operators (× ÷ ± ≠ etc.)
CURRENCY: currency symbols (€ £ ¥ ¢ etc.)

3

Entity cards

Each entity is displayed in a card showing three pieces of information:
Large character at the top - the actual rendered symbol
Entity name (orange) in the middle - e.g., &amp;, &lt;, &copy;
Unicode code at the bottom - e.g., U+0026, U+003C, U+00A9

Click any card to instantly copy the entity name (e.g., &copy;) to your clipboard. A Copied badge appears briefly to confirm.

HTML Entity reference cards showing characters, entity names, and Unicode codes
Entity reference cards
4

Examples from reference

Some entities you'll find in the reference:
&&amp; (U+0026) - Ampersand
<&lt; (U+003C) - Less than
>&gt; (U+003E) - Greater than
©&copy; (U+00A9) - Copyright
®&reg; (U+00AE) - Registered trademark
&trade; (U+2122) - Trademark
&euro; (U+20AC) - Euro sign

Quick lookup
Can't remember the entity name for a symbol? Type the symbol itself into the search bar. The reference will find it and show you the entity code to use in your HTML.

Statistics counters

At the bottom right of the interface, three counters track your conversion in real-time. These help you understand the scope and effectiveness of the conversion.

1

CHARS counter

Shows the total number of characters in your input text.

This counts all characters including spaces, newlines, and special characters before any conversion takes place.

2

ENTITIES counter

In Text → Entities mode - Shows how many entities were created during encoding. If you input <div> (5 chars), it creates 2 entities (&lt; and &gt;).

In Entities → Text mode - Shows how many entities were found and decoded in your input.

3

CONVERTED counter

Shows the conversion percentage with an orange background for emphasis.
0%: No conversion happened (no special characters found)
Higher %: More of your input required conversion

Example: If 10 out of 100 characters needed entity conversion, this shows 10%.

Statistics counters showing CHARS, ENTITIES, and CONVERTED percentages
Statistics counters display real-time conversion metrics

Common entities list

Here are the most frequently used HTML entities organized by category. Memorizing these will save you time:

HTML reserved (must encode)
&lt; (<)
&gt; (>)
&amp; (&)
&quot; (")
&#39; (')

These MUST be encoded when displaying in HTML to avoid breaking your markup.
Legal & trademark
&copy; (©)
&reg; (®)
&trade; (™)

Common legal symbols for copyright notices and brand protection.
Currency symbols
&euro; (€)
&pound; (£)
&yen; (¥)
&cent; (¢)
&dollar; ($)

International currency symbols for e-commerce and financial content.
Math operators
&times; (×)
&divide; (÷)
&plusmn; (±)
&ne; (≠)
&le; (≤)
&ge; (≥)

Mathematical symbols for equations and technical documentation.
Arrows & directions
&larr; (←)
&rarr; (→)
&uarr; (↑)
&darr; (↓)
&harr; (⇄)

Directional arrows for navigation, instructions, and diagrams.
Spaces & typography
&nbsp; (non-breaking)
&ensp; (en space)
&emsp; (em space)
&ndash; (–)
&mdash; (—)

Typographic control for professional text formatting.

What are HTML entities?

HTML entities are special codes that represent characters in HTML documents. They're essential because some characters have special meaning in HTML or can't be typed directly on a keyboard. Understanding entities is fundamental for web development.

1

Why entities exist

In HTML, certain characters have special meanings:
< and > define HTML tags
& starts entity codes
" and ' delimit attribute values

If you want to display <div> as visible text (not as an actual HTML tag), you must write &lt;div&gt;. Otherwise, the browser interprets it as a real element.

2

Entity formats

Entities can be written in three formats:
Named entities: &amp; (ampersand), &lt; (less than), &copy; (copyright)
Decimal numeric: &#38; (ampersand by decimal number)
Hexadecimal numeric: &#x26; (ampersand in hex)

All three formats produce the same result - the ampersand character &.

3

The ampersand rule

Every HTML entity:
Starts with & (ampersand)
Ends with ; (semicolon)

This is how browsers recognize entities. The ampersand itself must be written as &amp; to avoid confusion with entity start sequences.

4

When to use entities

Use HTML entities for:
HTML reserved characters: < > & " '
Special symbols: © ® ™ € £ ¥
Characters not on keyboard: é ñ ü ß
User input on web pages: ALWAYS encode to prevent XSS attacks
Non-breaking spaces: &nbsp; to prevent line breaks

Entity encoding example
<!-- What you write in HTML source -->
&lt;div class=&quot;price&quot;&gt;
  Price: 5 &lt; 10 &amp; &euro;50
&lt;/div&gt;

<!-- What the browser displays -->
<div class="price">
  Price: 5 < 10 & €50
</div>

Security considerations

Always encode user input
Any text that comes from users (comments, form data, URL parameters) MUST be encoded before displaying on your web page. This is the primary defense against XSS (Cross-Site Scripting) attacks.
Server-side encoding in your apps
This tool is perfect for testing and manual conversions. When building your own web applications, always encode user input on the server side - client-side JavaScript can be bypassed by attackers.
Context matters
HTML entity encoding is specifically for HTML content. For JavaScript strings use JS escaping, for URLs use URL encoding, for SQL use parameterized queries. Each context needs its own encoding method.
Test your protection
Try entering <script>alert('XSS')</script> in your application's forms. If you see an alert popup, you have a vulnerability. If you see the literal text displayed, you're protected.
Store original, encode on display
Best practice: Store user input in its original form in your database, then encode when displaying. This preserves data integrity, allows full-text search, and lets you re-encode for different contexts.
Defense in depth
Don't rely on encoding alone. Combine with Content Security Policy (CSP) headers, input validation, output encoding, and regular security audits for comprehensive protection.

Common use cases

Here are real-world scenarios where HTML entity encoding is essential:

Blog comments
User comments may contain < > characters that break page layout. Encoding ensures comments display safely without executing as HTML.
Code tutorials
When writing tutorials that show HTML code, you must encode the examples so they display as text rather than being interpreted by the browser.
E-commerce
Product descriptions, reviews, and prices with currency symbols all need proper encoding to display correctly across all browsers.
Email templates
HTML emails need special characters encoded to render correctly across different email clients with varying encoding support.
Security sanitization
Any user-generated content (search queries, form inputs, URLs) must be encoded to prevent XSS attacks and injection vulnerabilities.
International content
Characters from different alphabets, accented letters, and special symbols ensure your content displays correctly regardless of page encoding.

Tips & Best practices

Use Named entities for readability
&copy; is much easier to understand in source code than &#169;. Enable the Named entities option when you want maintainable, readable HTML code.
Keep Auto-convert enabled
Real-time conversion helps you catch issues immediately. You'll see exactly how your text transforms as you type, making debugging easier.
Use Swap for quick round-trips
After encoding, use the Swap button to verify your encoded text decodes back correctly. This catches encoding errors before they reach production.
Learn the essential five
Memorize the five required encodings: &lt; &gt; &amp; &quot; &#39; - these handle 99% of everyday encoding needs for web development.
Use the reference search
Can't remember an entity? Don't Google it - just scroll down to the Entity reference and search. It's faster and shows you exactly what you need.
Share with teammates
Use COPY SHARE LINK to send encoded examples to teammates or include in documentation. The link preserves your exact input for easy reproduction.

Frequently asked questions

No. Only five characters MUST be encoded: < > & " ' (the HTML reserved characters). Other special characters (© € ™) should be encoded if you're unsure about your page's character encoding, but modern UTF-8 pages can display them directly without entities.
Named entities (&copy;) are human-readable but limited to defined names. Numeric entities (&#169; decimal or &#x00A9; hex) can represent ANY Unicode character. Both display identically in browsers. Use named for common symbols, numeric for obscure characters.
The Named entities option controls the OUTPUT format when encoding. In decode mode, both &copy; and &#169; produce the same © character, so there's no choice to make - you always get the actual character regardless of how it was encoded.
Your text was double-encoded. When & becomes &amp;, and then that gets encoded again, &amp; becomes &amp;amp;. Switch to Entities → Text mode and decode twice to fix this. Check your pipeline for multiple encoding steps.
This tool is excellent for understanding and testing encoding, but production applications should use server-side encoding libraries. Client-side encoding in JavaScript can be bypassed. Always encode on the server before sending HTML to browsers.
&nbsp; (non-breaking space) IS a space - it just prevents line breaks at that position. It's invisible like a regular space but keeps words together. Use it between numbers and units (100&nbsp;km) or in names that shouldn't wrap.
HTML entities are for HTML only. In JavaScript strings, use Unicode escapes: \u00A9 for ©. Or if your JS file is UTF-8 encoded, you can use the actual character directly: const copyright = '©';
URL encoding uses %20 for space, %26 for &. HTML encoding uses &nbsp; for non-breaking space, &amp; for &. They're completely different systems. Use our URL Encoder tool for URLs, this tool for HTML content.
No. All conversion happens locally in your browser using JavaScript. Your text never leaves your device. This tool works completely offline once loaded - no internet connection required for conversions.
Scroll down to the HTML Entity reference section. You can either browse categories (COMMON, SYMBOLS, ARROWS, MATH, CURRENCY) or type the symbol itself into the search bar. The reference will show you the entity name and Unicode code.

Ready to encode safely?

Convert text to HTML entities for secure, cross-browser compatible web pages.

Open HTML Entity Converter

Documentation