Blog
Image Tools
Crop Image
Resize Image
Rotate & Flip
Compress Image
Photo Filters
Meme Generator
GIF Maker
Collage Maker
Watermark Image
Blur Image
Convert
JPG to PNG
PNG to JPG
HEIC to JPG
DNG to JPG
Image Converter
PDF to JPG
JPG to PDF
Merge PDF
Compress PDF
MP4 to MP3
Video to GIF
MOV to MP4
MP3 Converter
Video & Audio
Trim Video
Crop Video
Remove Audio
Text to Speech
Audio Cutter
MP3 Compressor
Design & Editor
Resume Builder
Design Editor
Add Text to Photo
Social Media Resizer
QR Code Generator
Signature Generator
More Tools
Word Counter
Password Generator
Random Picker
Dice Roller
Spinner Wheel
Favicon Generator
Barcode Generator
Browse All Tools

HTML Encode

Escape text so it shows exactly as written inside a web page instead of being read as HTML. Angle brackets, ampersands and quotes become entities like < and &, which is what you need to show code samples, user comments or special characters safely.

100% Free
No Sign-up
Code Samples
All Symbols Option
Private · Nothing Saved Online
HTML Encode
Your Text
Input Characters—
Output Characters—
Lines In → Out—
Input Words—
Type or paste in the input box, or open a file. The result updates as you type.
Decode HTML entities
Text or HTMLType, paste or drop a file
Encoded HTML
Input—
Result—
Status—
Settings forYour text
What to Encode
Encoding every non-ASCII character gives pure ASCII output, useful for old systems and email templates.
File Name

How to HTML Encode Text

Quick answer: paste your text or code; the escaped version appears below, ready to paste into a web page.

  1. 1

    Paste your text

    Code, comments or symbols.

  2. 2

    Choose options

    Quotes and non-ASCII characters.

  3. 3

    Check the result

    Special characters become entities.

  4. 4

    Copy it

    Paste it into your page.

What You Get

Instant
As you type
Code Samples
Show code safely
Options
Quotes and symbols
ASCII Output
For old systems
Private
Nothing is uploaded
Any Device
Phone or computer

What Is HTML Encoding?

Web browsers read < and > as the start and end of HTML tags and & as the start of a special code. To show these characters as text, they must be written as entities: &lt; for <, &gt; for > and &amp; for &. Quotes are written as &quot; and &#39; when the text goes inside an attribute. HTML encoding, also called escaping, replaces all of them in one go.

Why It Matters

Without escaping, a code sample like <p> disappears from your page because the browser treats it as a real paragraph tag. Worse, text typed by users could change your page or run scripts if it is inserted without escaping. Encoding turns any text into something that is always shown exactly as written, which is why it is the basis of safe web development.

Options Explained

Encode quotes is needed when the text goes inside an HTML attribute, such as title="…". It can be turned off for text placed between tags, where quotes are harmless. Encode every non-ASCII character turns letters like é, dashes, symbols and emoji into numeric entities like &#233;. The result contains only basic ASCII characters, which is useful for old systems, some email templates and files saved in old encodings.

Example

Encoding <p class="note">Tom & Jerry</p> gives &lt;p class=&quot;note&quot;&gt;Tom &amp; Jerry&lt;/p&gt;. Pasted into a page, it shows the original code as visible text. To turn entities back into characters, use HTML Decode.

Who Uses HTML Encoding?

Bloggers and teachers showing code examples, developers inserting text into templates by hand, people writing documentation and help articles, email template designers, and content editors whose system shows raw tags instead of text. It is also handy for preparing text for XML files, which use the same five special characters.

Good to Know

Encode text only once: encoding &amp; again gives &amp;amp;, which shows as "&amp;" on the page. Modern pages saved as UTF-8 do not need accented letters encoded, so leave that option off unless you have a reason. Line breaks and spaces are kept as they are; use <br> tags or the TXT to HTML converter if you need the line breaks to show on the page.

Step by Step

Paste the code or text exactly as it should appear on the page. Keep Encode quotes ticked if the text will go inside an attribute, and tick the non-ASCII option only if the destination cannot handle UTF-8. Copy the encoded text into your page, post or template, then preview it: the special characters should show as normal characters, not disappear or turn into formatting.

For code samples, place the encoded text inside pre and code tags so that spacing and line breaks are kept on the page.

Private, Free and Instant

The encoder is free and handles long documents up to 5 MB. There is no sign-up, no limit and nothing to install. Everything runs inside your browser, so passwords, tokens, customer data and private messages are never uploaded, logged or stored anywhere. The result updates instantly as you type or paste, and you can open a text file from your device and download the result as a new file. It works on Windows, Mac, Linux, Chromebooks, iPhone and Android.

Encoding HTML Safely: Which Characters Need Escaping

HTML gives a few characters special meaning: less-than and greater-than begin and end tags, the ampersand starts an entity, and quotation marks end attributes. To show these characters as text on a page, they must be written as entities.

The key entities

  • & becomes &amp;
  • < becomes &lt; and > becomes &gt;
  • Double quote becomes &quot;
  • Apostrophe becomes &#39;

Why it matters

Encoding user-supplied text before showing it is a basic defence against cross-site scripting, where injected script runs in other people's browsers. It also lets you display code samples on a web page. Remember that encoding depends on context; text inside a script or a URL needs different handling than text between tags. To reverse it, use HTML decode.

Frequently Asked Questions

Questions about HTML encoding

How do I escape HTML?

Paste your text or code and copy the encoded result.

Which characters are encoded?

Less-than and greater-than signs, ampersands and, by default, double and single quotes.

Can I encode accented letters and emoji?

Yes. Tick Also encode every non-ASCII character.

Why do ampersand codes show up as text on my page?

The text was encoded twice. Decode it once with HTML Decode.

Is this the same as URL encoding?

No. HTML encoding is for page content; URL encoding is for web addresses.

Is my text sent anywhere?

No. Encoding and decoding happen in your browser on your own device. Nothing is uploaded or stored.