Back to Tools

URL Encoder/Decoder

Encode and decode URL strings to ensure proper formatting and security

Input

Output

URL Encoding Examples

hello world
Use
hello%20world
Spaces become %20
price=$100&discount=50%
Use
price%3D%24100%26discount%3D50%25
Special characters encoded
query=search term&sort=date
Use
query%3Dsearch%20term%26sort%3Ddate
Query parameters
email=user@example.com
Use
email%3Duser%40example.com
Email in URL parameters

About URL Encoding

URL encoding (also known as percent-encoding) converts characters into a format that can be safely transmitted over the internet. It ensures that URLs remain valid and secure by encoding special characters.

Why URL Encoding is Important:

  • Security - Prevents URL injection attacks
  • Compatibility - Ensures URLs work across different systems
  • Reliability - Prevents broken links from special characters
  • Standards Compliance - Follows RFC 3986 standards

Commonly Encoded Characters:

Space
→ %20
&
→ %26
=
→ %3D
@
→ %40

When to Use URL Encoding:

  • Query parameters in URLs
  • Form data submission
  • API requests with special characters
  • URLs containing spaces or non-ASCII characters
  • Data being passed in HTTP headers

Technical Details:

// JavaScript functions used:
encodeURIComponent(string) - Encodes a URI component
decodeURIComponent(string) - Decodes a URI component

// Example:
encodeURIComponent('hello world') = 'hello%20world'
decodeURIComponent('hello%20world') = 'hello world'

Best Practices:

  • Always encode user input before including it in URLs
  • Use encodeURIComponent() for query parameters
  • Use encodeURI() for complete URLs (preserves ://, etc.)
  • Decode URLs before displaying to users
  • Validate decoded input for security