Free Text Convert

Simple, fast, and free text transformation tools

Escape Unescape Online Tool - URL HTML JSON Encoder Decoder

Need to escape special characters for URLs, HTML, or JSON? Our free escape/unescape online tool instantly encodes and decodes text for safe transmission across different systems. Whether you're fixing broken URLs with spaces, preventing XSS attacks in HTML, or formatting JSON strings correctly, handle special characters properly in seconds - no coding required.

Quick Solution: Use our Escape/Unescape Tool for instant encoding/decoding, or continue reading to master text escaping techniques.

Understanding Text Escaping

Text escaping is like putting fragile items in protective packaging before shipping. Just as bubble wrap protects glass during transport, escaping protects special characters when text moves between different systems or contexts.

Every computer system has reserved characters with special meanings. When your text contains these characters, they need to be "escaped" (converted to a safe format) to prevent misinterpretation.

Real-world example: URL: example.com/search?q=coffee & tea Problem: The & means "new parameter" in URLs Solution: example.com/search?q=coffee%20%26%20tea

Why Escaping Matters

  • Security: Prevents code injection attacks (XSS, SQL injection)
  • Functionality: Ensures data transmits correctly
  • Compatibility: Works across different systems
  • Data Integrity: Preserves original meaning

URL Encoding/Decoding

URLs can only contain specific characters. Spaces, special symbols, and non-ASCII characters must be percent-encoded to work properly in web addresses.

How URL Encoding Works

Each unsafe character converts to % followed by its hexadecimal ASCII code:

Character URL Encoded Common Use
Space %20 Search queries
& %26 Multiple parameters
# %23 Hashtags, anchors
+ %2B Plus signs in data
/ %2F Path separators

Real-World URL Encoding Examples

// Search query with spaces Before: https://api.example.com/search?q=best coffee shops After: https://api.example.com/search?q=best%20coffee%20shops // Email with special characters Before: mailto:user@example.com?subject=Question & Feedback After: mailto:user@example.com?subject=Question%20%26%20Feedback // International characters Before: https://example.com/cittΓ  After: https://example.com/citt%C3%A0

πŸ’‘ Pro Tip

Modern browsers automatically encode URLs in the address bar, but you still need manual encoding for: β€’ API calls in code β€’ Form submissions β€’ Dynamic URL building β€’ Query string parameters

HTML Entity Encoding

HTML entity encoding prevents text from being interpreted as HTML code. This is crucial for displaying code examples and preventing security vulnerabilities.

Essential HTML Entities

Character HTML Entity Purpose
< &lt; Prevent tag creation
> &gt; Close tag prevention
& &amp; Entity prevention
" &quot; Attribute safety
' &#39; JavaScript safety

Security Example: XSS Prevention

Dangerous (allows XSS): User comment: <script>alert('Hacked!')</script> Display: [Script executes!] Safe (escaped): User comment: &lt;script&gt;alert('Hacked!')&lt;/script&gt; Display: <script>alert('Hacked!')</script>

JSON String Escaping

JSON has strict rules for string formatting. Special characters must be escaped with backslashes to create valid JSON that parsers can understand.

JSON Escape Sequences

// Quote escaping Input: He said "Hello" JSON: "He said \"Hello\"" // Backslash escaping Input: C:\Users\Documents JSON: "C:\\Users\\Documents" // Newline escaping Input: Line 1 Line 2 JSON: "Line 1\nLine 2" // Complete JSON example { "message": "Welcome to \"Free Text Convert\"", "path": "C:\\tools\\converter", "description": "Line 1\nLine 2\nLine 3", "special": "Tab\there\tand\tthere" }

Common JSON Escaping Scenarios

  • API Responses: User-generated content in JSON APIs
  • Configuration Files: Paths and settings with special chars
  • Log Messages: Multi-line error messages
  • Data Export: CSV to JSON conversions

JavaScript String Escaping

JavaScript strings can use single or double quotes, and special characters need proper escaping to prevent syntax errors or security issues.

// Single quote strings const message = 'It\'s a beautiful day'; // Double quote strings const html = "She said, \"Hello!\""; // Template literals (ES6+) const multiline = `Line 1 Line 2 Line 3`; // No escaping needed! // Mixed quotes const complex = 'He said, "It\'s working!"'; // Special characters const special = 'Tab:\tNewline:\nBackslash:\\'; // Unicode escaping const emoji = '\u{1F600}'; // πŸ˜€

Ready to Escape Your Text?

Stop breaking URLs and JSON - escape special characters instantly!

Open Escape/Unescape Tool β†’

Base64 Encoding/Decoding

Base64 encoding converts binary data or text into a safe ASCII format using only 64 characters. While not technically "escaping," it's essential for data transmission.

Base64 Use Cases

1. Data URLs for Images: <img src="data:image/png;base64,iVBORw0KGgoAAAANS..."> 2. Basic Authentication: Authorization: Basic dXNlcjpwYXNzd29yZA== 3. Email Attachments: Content-Transfer-Encoding: base64 4. Storing Binary in JSON: {"file": "SGVsbG8gV29ybGQh"}

How to Use Our Escape/Unescape Tool

Our tool simplifies the encoding/decoding process with an intuitive interface:

  1. Visit the Tool: Go to our Escape/Unescape page
  2. Select Format: Choose from URL, HTML, JSON, JavaScript, or Base64
  3. Choose Operation: Click "Escape" or "Unescape"
  4. Enter Text: Paste or type your content
  5. Get Results: See instant conversion
  6. Copy Output: One-click copy to clipboard

πŸš€ Power Features

β€’ Swap Button: Quickly reverse operations
β€’ Character Count: Track size changes
β€’ Reference Table: See common escape sequences
β€’ Example Presets: Learn by example

Best Practices for Text Escaping

1. Choose the Right Format

Each context requires specific escaping:

  • URLs: Use URL encoding (percent encoding)
  • HTML Display: Use HTML entities
  • HTML Attributes: Use HTML entities + quote escaping
  • JSON Data: Use JSON escaping
  • JavaScript Strings: Use JS escaping
  • Binary Data: Use Base64 encoding

2. Security First

Always escape user input before displaying or processing:

  • Escape HTML to prevent XSS attacks
  • Escape SQL to prevent injection
  • Escape shell commands to prevent execution
  • Validate after unescaping

3. Context Awareness

HTML in JavaScript in HTML: <script> const html = "<div class=\"alert\">User said: &quot;Hello!&quot;</div>"; </script> This needs: 1. HTML entity encoding for the quotes 2. JavaScript escaping for the string 3. Proper script tag handling

Common Errors to Avoid

1. Double Escaping

❌ Wrong: URL encode: hello%20world URL encode again: hello%2520world βœ… Right: Check if already encoded before escaping again

2. Mixed Encoding

❌ Wrong: JSON with URL encoding: {"url": "example.com%2Fpage"} βœ… Right: JSON with proper value: {"url": "example.com/page"} Then URL encode when building the actual URL

3. Insufficient Escaping

❌ Wrong: Only escaping < and > in HTML βœ… Right: Escaping all five critical HTML characters: < > & " '

4. Wrong Direction

❌ Wrong: Trying to "escape" already-escaped text Result: &amp;lt; instead of < βœ… Right: Use "unescape" for already-escaped text

Frequently Asked Questions

What's the difference between encoding and escaping?

Encoding transforms entire data formats (like Base64), while escaping adds markers to special characters (like backslashes in JSON). Both make text safe for specific contexts.

Do I need to escape text in modern frameworks?

Modern frameworks (React, Angular, Vue) auto-escape for HTML display, but you still need manual escaping for:

  • URL parameters
  • JSON string creation
  • Dynamic SQL queries
  • Shell commands
  • Regular expressions

Which characters are always safe?

Alphanumeric characters (A-Z, a-z, 0-9) are safe in all contexts. Everything else depends on the specific format:

  • URLs: Also allow - _ . ~
  • HTML: Most punctuation except < > & " '
  • JSON: All UTF-8 except " \ / and control chars

Can I use this tool for passwords?

While our tool can encode passwords for transmission (like Base64 for basic auth), remember:

  • Encoding is NOT encryption
  • Base64 is easily reversible
  • Use proper encryption for sensitive data
  • Never store passwords in plain text or Base64

How do I know which format to use?

Follow the destination rule: Where is your text going?

  • Into a URL? β†’ URL encode
  • Into HTML? β†’ HTML entities
  • Into JSON? β†’ JSON escape
  • Into JavaScript? β†’ JS escape
  • Over email/binary-unsafe channel? β†’ Base64

Conclusion

Text escaping is a fundamental skill for anyone working with web technologies. Whether you're a developer building APIs, a content creator managing websites, or a data analyst processing information, proper escaping ensures your data travels safely and displays correctly.

Our escape/unescape tool handles the complexity for you, providing instant, accurate conversions for all major formats. No more broken URLs, invalid JSON, or security vulnerabilities from unescaped text.

Ready to escape text like a pro? Try our free Escape/Unescape Tool now and handle special characters with confidence!