Free & Private Online Browser Utility
HTML Entity Encoder & Decoder
Encode special characters into safe HTML entities and decode character references back to plain text directly in your browser. Convert dangerous symbols (&, <, >, ", ') into named entities (&, <, >) or numeric decimal (<) and hexadecimal (<) equivalents to prevent cross-site scripting (XSS) and broken markup. All string transformations execute locally in browser memory without sending text over the network.
How to use
-
Step 1: Paste Source Text
Enter or paste HTML code snippets, user input strings, or formatted text into the editor.
-
Step 2: Select Encoding Format
Choose Named Entities (&), Decimal Numeric (&), or Hexadecimal (&).
-
Step 3: Copy Sanitized Result
Click Copy to grab the encoded markup ready to embed safely in HTML source files.
Worked example
Input: String: '<script>alert("XSS")</script>'
Output: Encoded: '<script>alert("XSS")</script>'
Processed via DOM element attribute escaping and Unicode code point mapping.
Tips & limits
- The 5 primary XML/HTML entities requiring escaping are: & (&), < (<), > (>), " ("), and ' (').
- Always encode user-supplied text before rendering it inside HTML tags to prevent cross-site scripting attacks.
- Numeric entities (<) work in strict XML and SVG contexts where HTML entity names like may fail.
Common problems
- Double-encoding turns < into &lt;
Avoid running entity encoding on already-encoded text; decode first if working with mixed data sources.
- Non-breaking spaces appear as weird characters
translates to Unicode non-breaking space (U+00A0); use standard decode mode to restore standard spaces.
Frequently Asked Questions (FAQ)
Why is HTML entity encoding critical for web security?
Encoding characters like < and > helps browsers treat user input strictly as text rather than executable markup, neutralizing cross-site scripting (XSS) vectors.
What is the difference between named and numeric entities?
Named entities use mnemonic words (© for ©) defined in HTML specifications; numeric entities use exact Unicode code points (© or ©) recognized across all XML parsers.
Is my text data stored or shared?
No. All entity mapping and regex replacements run in local browser memory with zero network requests.