iloveweb.tools
iloveweb.tools

URL Encode/Decode

Encode special characters for URLs or decode percent-encoded strings. Essential for web development and API work.

Plain URL/Text
Encoded Output

What is URL Encoding?

URL encoding (also called percent-encoding) converts characters into a format that can be transmitted over the internet safely. Special characters like spaces, ampersands, and non-ASCII characters are replaced with % followed by their hexadecimal value.

For example, a space becomes %20, and an ampersand becomes %26. This is essential for including special characters in URLs without breaking them.

Common URL Encoding Examples

CharacterEncodedWhy It's Reserved
space%20 or +Separates URL components
&%26Separates query parameters
=%3DAssigns values to parameters
?%3FStarts query string
#%23Fragment identifier

💡 Space Encoding

Spaces can be encoded as %20 or +. Use %20 for URL paths and + for form data. Modern APIs typically expect %20.

When to Use URL Encoding

Query Parameters

When passing user input in URLs: ?search=hello%20world&category=books. Without encoding, spaces and special characters would break the URL structure.

API Requests

Many APIs require encoded values in request URLs. File names, user queries, and filter options often contain characters that need encoding.

Form Submissions

HTML forms with GET method encode data automatically. Understanding encoding helps debug form submission issues.

Frequently Asked Questions

What's the difference between encodeURI and encodeURIComponent?

encodeURI preserves URL structure characters (:, /, ?, #). encodeURIComponent encodes everything for use as a parameter value. Our tool uses component encoding for maximum safety.

Are emojis URL-safe?

No! Emojis and non-ASCII characters must be encoded. A 😀 emoji becomes a long sequence like %F0%9F%98%80. Always encode user input containing emojis.

Can I encode entire URLs?

Be careful—encoding an entire URL would break it (the :// and / would become %3A%2F%2F). Only encode values, not the URL structure itself.

Security Considerations

  • XSS Prevention: Proper encoding prevents script injection
  • Double Encoding: Avoid encoding already-encoded strings
  • Server Compatibility: Some servers have character limits