HTML Entity Encoder: Escape HTML Characters Online
Escape <, >, &, quotes and accents as HTML entities (<, &, é) in Essential, Named or Numeric mode. Runs entirely in your browser.
Updated November 2026
Reviewed by Rafael Duarte
How the HTML entity encoder works
Paste, pick a mode, copy — three steps
1. Paste your text
Type or paste any string into the input field — plain text, a code snippet, or raw HTML.
2. Choose a mode
The tool opens in Named Entities, which also turns accents and symbols into entities. To escape only & < > " ', switch to Essential; for decimal references on every non-ASCII character, pick Numeric.
3. Copy the result
The output updates live as you type. Click Copy to send it to your clipboard; Shift+Enter also works, but only with the cursor outside the text box.
What this HTML entity encoder does
Escape HTML characters in three encoding modes
Essential mode
Encodes only & < > " ' — the minimum needed to output text safely in HTML content and quoted attributes, and the recommended mode for most cases.
Named entities
Covers accented letters, currency symbols, arrows, Greek letters and math symbols by name (about 250 classic HTML 4 entities such as é and €); characters outside that list fall back to numeric references.
Numeric entities (&#…;)
Converts every non-ASCII character to a decimal reference — maximum compatibility with older or strict parsers.
Runs entirely in your browser
No text is ever sent to a server — encoding happens locally in JavaScript, instantly.
Examples
<div> (any mode)<div>Tom & Jerry (any mode)Tom & Jerry"hello" (any mode)"hello"it's (any mode)it'scafé €10 (Named Entities, the default)café €10café €10 (Essential)café €10 (unchanged: only & < > " ' are escaped)café €10 (Numeric)café €10When you'll need this tool
The most common scenarios people use it for
Preventing XSS
Before rendering user-supplied content in HTML, always encode it first — a <script> tag should show up as text, not execute. This covers HTML text and quoted attributes; inside <script>, URLs, CSS or unquoted attributes, each context needs its own escaping.
Code examples in docs
Display raw HTML tags as readable text inside a <pre> block without the browser interpreting them.
Email templates
Encoding special characters avoids rendering glitches in Gmail, Outlook and Apple Mail.
CMS content input
Makes sure special characters survive the round trip from database to browser without breaking markup.
Sanitizing API responses
Check that your backend's encoding logic actually produces the output you expect before shipping it.
Which mode should you use? Start here
Confusing it with URL encoding
HTML encoding uses entities (< → <); URL encoding uses percent-encoding (< → %3C) — they solve different problems.
Over-encoding everything
Modern UTF-8 pages don't need Named or Numeric entities just for accented letters — Essential mode is enough in most cases.
Relying only on your framework
React, Svelte and Vue auto-escape in normal bindings — manual encoding is only needed with innerHTML or dangerouslySetInnerHTML.
Why encode HTML entities here
Everything runs in your browser via JavaScript, so the text you escape is never sent to, stored on, or logged by a server.
Three modes cover everything from the minimal security baseline (Essential) to maximum compatibility with legacy parsers (Numeric), without needing to memorize which named entity maps to which character.
Frequently asked questions
HTML encoding replaces characters with entities (< becomes <) so they display safely inside a document. URL encoding uses percent-encoding (< becomes %3C) so characters survive transmission inside a URL. Use HTML encoding whenever you're inserting content into HTML markup, not a link.
The tool opens in Named Entities, but Essential is the right choice for the vast majority of cases: it neutralizes XSS in HTML text and quoted attributes (inside JavaScript, URLs or CSS, use that context's own escaping). Modern browsers handle UTF-8 accented letters natively, so Named or Numeric entities only make sense for legacy systems or older email clients that don't render UTF-8 reliably.
Yes. All processing happens locally in your browser — nothing you type is ever sent to, stored on, or logged by a server.
Yes, they describe the same operation — "escaping" is the verb, "encoding" describes the resulting entity transformation. The terms are used interchangeably in documentation and tooling.
In React, Svelte and Vue, the framework already auto-escapes content inside normal bindings like {variable}. Manual HTML encoding is only necessary when you're using dangerouslySetInnerHTML, innerHTML, or generating raw HTML on the server.
Yes, in every mode. A single quote becomes ' rather than ', which HTML 4 didn't define, so the output is safe inside attributes wrapped in single quotes too.
Click Swap & Decode. It opens the HTML Entity Decoder as a separate page with the encoded result already in the input, and the plain text appears right away.
References
Related Tools
- HTML Entity Decoder: Unescape HTML to Plain Text Developer Paste text with <, &, " or ' and get plain text back. Decodes every HTML5 named entity plus decimal and hex references, in your browser.
- Base64 Encoder: Encode Text, PDF & Files Online Developer Encode UTF-8 text or any file (PDF, DOCX, XLSX, ZIP up to 50 MB) to Base64 or Base64URL. Runs in your browser, nothing is uploaded. Free, no sign-up.
- Image to Base64 Converter: Data URI, HTML & CSS Developer Drop a PNG, JPG, WebP, GIF or SVG up to 20 MB and copy raw Base64, a data URL, an <img> tag or a CSS url(). Runs in your browser, nothing uploaded.
- URL Encoder: Encode Query Strings, Spaces & UTF-8 Developer Turn spaces, accents and symbols into %20, %C3%A9 and %26 for links and query strings, with spaces as %20 or +. Runs locally in your browser.
- Base64 Decode Online — Free Base64 to Text Decoder Developer Free online Base64 decoder — decode Base64 strings back to plain text instantly in your browser. Validates input and shows decoded payload size.