HTML Entity Encode and Decode
Show code on a web page without the browser running it, put text safely inside an HTML attribute, or turn a string full of & and ' back into normal text.
- Free
- Runs in your browser
- Named and numeric entities
- No sign-up
How It Works
Escape or unescape HTML in three steps.
Choose Encode or Decode
Encode makes text safe for HTML, Decode makes entities readable.
Paste your text
A code sample, a product title or a database value full of entities.
Copy the result
Paste it into your page, template or CMS.
What are HTML entities?
Five characters have a special meaning in HTML: < and > start and end tags, & starts an entity, and double and single quotes end attribute values. To show them as text you write them as entities instead: <, >, &, " and '. Entities can also name any character by number, such as é for é, which helps when a system cannot handle UTF-8.
Escaping text before inserting it into a page is one part of preventing cross-site scripting. Inside <script> blocks, URLs and CSS, different escaping rules apply, so rely on your framework's escaping there.
The five that matter
Encoding escapes & < > " and ', which is enough for text inside elements and attributes.
Numeric option
Optionally writes every non-ASCII character as &#number;, for old email templates and systems that mangle UTF-8.
Decodes every entity
Named ( , ©, é), decimal (é) and hex (é) entities are decoded by your browser's own HTML parser.
Nothing runs
Decoding reads the text only; scripts in the input are not executed.
Convert PDF Files and File Formats
Find the perfect online tool to combine PDF files, compress documents, and handle your daily workflow effortlessly.
PDF Tools
All your PDF needs in one place
- Merge PDF
- Organize PDF
- Split PDF
- Compress PDF
- Convert to Word
- Convert to Image
Image Tools
Edit and optimize your images
- Resize Image
- Compress Image
- Convert Format
- Crop Image
- Add Watermark
- Remove Background
Word Tools
Work with Word documents
- Convert to PDF
- Merge Documents
- Split Documents
- Compress File
- Edit Text
- Add Watermark
Excel Tools
Process Excel spreadsheets
- Convert to PDF
- Convert to CSV
- Merge Sheets
- Split Sheets
- Compress File
- Clean Data
Why Use This Entity Tool
Clean escaping in both directions.
Show code samples
Paste HTML and get text you can put inside <pre> without the browser rendering it.
All named entities
Decoding uses the browser's full entity list, not a short table.
UTF-8 fallback
The non-ASCII option helps with email clients and legacy systems.
Private
Everything runs in the browser tab.
Frequently Asked Questions
Questions people ask about the HTML entity encoder and decoder.
Inside text, < and & must be escaped. Inside an attribute value, the quote character that wraps it must be escaped too. Escaping all five (& < > " ') is the safe default and is what Encode does.
It was encoded twice: & became &, then that & became & again. Decode it twice to get the original text.
Not if your page is served as UTF-8, which almost all are. Use the numeric option only for systems that break non-ASCII characters.
Both are a single quote. ' is valid in HTML5 and XML but not in HTML 4, so ' is the more compatible choice and the one this tool writes.
Related Text & Developer Tools
More small utilities that run in your browser.
HTML to Markdown
Turn HTML or a web page snippet into Markdown.
Markdown to HTML
Convert Markdown to clean HTML with a live preview.
URL Encode & Decode
Percent-encode text for URLs or decode it.
Base64 Encode & Decode
Encode text to Base64 or decode it back.
XML to JSON
Convert XML to JSON with attributes kept.