Plain Text Input

Encoded Output

What Is a Text to HTML Entities Encoder?

Whenever you need to display characters like &, <, or > inside HTML without the browser interpreting them as markup, you need to encode them as entities. This tool converts those characters — along with symbols like ©, , , and more — into their named HTML entity equivalents. It's the kind of thing you run into constantly when building templates, writing documentation, or preparing content for CMS platforms.

The encoding covers the five characters that are mandatory to escape in HTML (&, <, >, ", ') plus common symbols like currency signs, arrows, and typographic marks. If you need programmatic encoding in JavaScript or Node.js, the he library handles both encoding and decoding with full spec compliance. For a quick reference of all available entities, MDN's entity glossary is a good starting point.

How to Use This Tool

1

Paste Your Text

Paste plain text into the left editor, or click Upload to load a file. Hit Sample to try a ready-made example.

2

See the Encoded Output

The right panel shows the encoded text instantly as you type. Characters like & become &amp;, < becomes &lt;, and symbols like © become &copy;.

3

Copy or Download

Use Copy to grab the encoded text or Download to save it as a file. If you need to go the other direction, try the HTML Entities to Text decoder.

Encoding Example

Here's a chunk of plain text with special characters that need encoding before they're safe to use inside HTML:

Plain text input

Input

When You'd Actually Use This

The most common scenarios are preparing content for HTML templates, blog posts, or CMS platforms where special characters would break the markup. It's also essential when displaying user-generated content safely — encoding < and > prevents cross-site scripting (XSS) attacks. You'll also use this when writing code examples in HTML, building email templates, or embedding text in XML-based formats. The full list of named entities is in the W3Schools HTML entities reference, and the Unicode table maps every character to its code point.

If you need to decode entities back to text, try the HTML Entities to Text decoder.

Frequently Asked Questions

Which characters does this tool encode?

It encodes the five mandatory HTML characters (&, <, >, ", ') plus common symbols like ©, ®, , , £, ¥, °, ±, ×, ÷, arrows, and non-breaking spaces.

Is this the same as HTML escaping?

Close, but not identical. HTML escaping typically only converts the five characters that could be interpreted as markup (&, <, >, ", '). This tool goes further by also converting common symbols into their named entities, which is useful for readability and compatibility.

Does it handle Unicode characters?

It converts commonly used Unicode symbols (copyright, trademark, currency, math operators, arrows) into their named entities. Characters without a standard named entity are left as-is — they're valid UTF-8 and don't need encoding for modern browsers.

Is any data sent to a server?

No. The encoding runs entirely in your browser using simple string replacements. Nothing is uploaded or stored anywhere.

Can I use this to prevent XSS attacks?

Encoding < and > to &lt; and &gt; is a basic XSS prevention measure, but proper security requires server-side sanitization too. This tool is great for quick encoding, but for production apps, use a proper sanitization library like DOMPurify.

Related Tools

All named character references are listed in the HTML Living Standard. For a quick lookup, see the W3Schools HTML entities reference. The MDN entity glossary explains how entities work. For encoding in Node.js, the he library is widely used. The Unicode character table maps every symbol to its code point.