URL Encoder & Decoder

Percent-encode text for URLs or decode encoded strings -- free, private, in your browser

Decoded Text
URL-Encoded

What Is URL Encoding?

URL encoding, also called percent-encoding, is the method of representing characters in a URL using a percent sign followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26. This encoding is defined by RFC 3986 and ensures that special characters do not break the structure of a URL.

URLs can only contain a limited set of characters from the ASCII character set. Characters outside the unreserved set (letters, digits, hyphens, underscores, periods, and tildes) must be percent-encoded when they appear in URL components like query parameter values. This includes spaces, punctuation, and all non-ASCII characters like accented letters or CJK characters.

How to Encode and Decode URLs

  1. Choose the encoding mode: Component for individual query parameter values (encodes all special characters), or Full URL to preserve URL structure characters like :, /, ?, and #
  2. Type or paste your text into the Decoded Text field on the left
  3. Click Encode to see the percent-encoded result on the right
  4. To decode, paste a percent-encoded string into the right field and click Decode
  5. Use the Copy button to copy either value to your clipboard

encodeURI vs encodeURIComponent

encodeURIComponent encodes everything except unreserved characters (letters, digits, -_.~). Use it for query parameter values, path segments, or any piece of data that will be embedded into a URL. This is the right choice in most situations.

encodeURI preserves characters that have structural meaning in URLs: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Use it only when you have a complete URL and want to fix illegal characters (like spaces or non-ASCII characters) without breaking the URL structure.

Example: encoding the string hello world&foo=bar

Common Characters and Their Encoded Forms

CharacterEncodedNotes
Space%20+ in form data (application/x-www-form-urlencoded)
&%26Separates query parameters
=%3DSeparates key from value
?%3FStarts query string
#%23Fragment identifier
/%2FPath separator
+%2BOften confused with space
@%40Used in email addresses and userinfo
%%25The escape character itself

Frequently Asked Questions

Why do spaces become %20 or +?

The %20 encoding comes from RFC 3986 and is the standard percent-encoding for a space. The + encoding comes from the older application/x-www-form-urlencoded format used by HTML forms. Both are valid, but %20 is always safe. Use encodeURIComponent, which produces %20, for general-purpose URL encoding.

Do I need to encode the whole URL or just the parameter?

Encode only the parts that contain user data or special characters -- typically query parameter values. If you encode an entire URL with encodeURIComponent, you will break it by encoding the slashes, colons, and question marks that give it structure. Use encodeURIComponent for values and encodeURI for complete URLs.

How does URL encoding handle Unicode?

Non-ASCII characters are first encoded as UTF-8 bytes, then each byte is percent-encoded. For example, the character "n" (U+00F1) becomes the UTF-8 bytes C3 B1, which are encoded as %C3%B1. JavaScript's encodeURIComponent handles this automatically.