URL Encoder / Decoder

Encode or decode URL-encoded strings instantly. Free online tool for developers.

What is URL Encoding?

URL encoding, also known as percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). It converts characters into a format that can be safely transmitted over the internet. URLs can only be sent over the internet using the ASCII character set, so any characters outside this set — or characters that have special meaning in URLs — must be encoded.

When Should You Use URL Encoding?

URL encoding is essential in many web development scenarios. Here are the most common use cases:

  • Query string parameters: When passing data via GET parameters (e.g., ?name=John+Doe&city=New+York), spaces and special characters must be encoded.
  • Non-ASCII characters: Characters like Chinese, Arabic, or emoji need to be percent-encoded to be safely included in URLs.
  • Reserved characters: Characters like &, =, ?, #, and / have special meanings in URLs. If you want to use them as literal data, they must be encoded.
  • Form submissions: When forms are submitted with application/x-www-form-urlencoded, browsers automatically encode the data.
  • API requests: When building REST API calls with dynamic path segments or query parameters, encoding ensures the URL remains valid.
  • Redirects: When crafting redirect URLs that contain user-generated content, encoding prevents broken links.

Common URL Encoding Reference

Here are some commonly encoded characters and their percent-encoded equivalents:

  • Space → %20 (or + in query strings)
  • !%21
  • #%23
  • $%24
  • %%25
  • &%26
  • '%27
  • (%28
  • )%29
  • *%2A
  • +%2B
  • ,%2C
  • /%2F
  • :%3A
  • =%3D
  • ?%3F
  • @%40

encodeURI vs encodeURIComponent

In JavaScript, there are two commonly used encoding functions, and understanding the difference is important:

  • encodeURI() — Encodes a complete URI. It does not encode characters that have special meaning in a URI (, / ? : @ & = + $ #). Use this when encoding an entire URL.
  • encodeURIComponent() — Encodes a URI component. It encodes all characters except A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use this for encoding individual query parameter values or path segments.

Best Practices

When working with URL encoding in your web applications:

  • Always use encodeURIComponent() for query parameter values to avoid injection vulnerabilities.
  • Be consistent with encoding across your entire application — mixing encoded and unencoded URLs can lead to double-encoding issues.
  • When decoding, use decodeURIComponent() to handle percent-encoded strings. Be aware that it throws an error on malformed input.
  • Consider using the URL and URLSearchParams APIs in modern JavaScript — they handle encoding automatically.
  • Test your URLs with both encoded and unencoded special characters to ensure your application handles edge cases gracefully.

Why Use Our URL Encoder Tool?

Our free URL encoder/decoder provides instant, accurate encoding and decoding right in your browser. No data is sent to any server — everything happens locally for maximum privacy and speed. Whether you're debugging API calls, constructing query strings, or sanitizing user input, this tool helps you get the job done quickly.