Skip to main content
CalcHive

URL Encode & Decode

Examples

Query parameter with spaces

In:hello world & goodbye
Out:hello%20world%20%26%20goodbye

Email address

In:user@example.com
Out:user%40example.com

URL with special characters

In:https://example.com/path?q=foo bar&lang=en
Out:https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dfoo%20bar%26lang%3Den
Share:

Encode or decode URL strings (percent-encoding) instantly. Perfect for query strings, API parameters, and debugging URLs.

How to Use URL Encode & Decode

  1. Select Encode or Decode mode.
  2. Paste or type your string in the input area.
  3. The result appears instantly in the output area.
  4. Click "Copy" to copy the result.

What is URL Encoding?

URL encoding (percent-encoding) replaces characters that aren't allowed in URLs with a % followed by their hex value. Spaces, ampersands, question marks, and non-ASCII characters all need encoding when used inside query parameters or path segments.

Characters That Need Encoding

Spaces can be encoded as %20 or + depending on context. %20 is correct for path segments, while + is only valid in application/x-www-form-urlencoded data (form submissions). Reserved characters like &, =, #, ?, and / have special meaning in URLs and must be percent-encoded when used as literal values in query parameters. Non-ASCII characters (accented letters, CJK characters) get UTF-8 encoded first, then each byte is percent-encoded.

The Double-Encoding Trap

One of the most common bugs: encoding an already-encoded string. If a URL contains %20 and you encode it again, the % becomes %25, giving you %2520. This breaks the URL silently. You see it a lot when passing redirect URLs as query parameters. Encode the redirect URL once, then embed it. Never run the whole final URL through an encoder.

encodeURI vs encodeURIComponent

In JavaScript, encodeURI() encodes a full URL but preserves delimiters like :, /, ?, and #. Use it when you have a complete URL. encodeURIComponent() encodes everything except - _ . ~ and is what you want for individual query parameter values. Getting this wrong is a frequent source of broken API calls.

For encoding binary data as text, try our Base64 Encoder. You can also inspect authentication tokens with the JWT Decoder, or encode special characters for HTML with the HTML Entity Encoder.

Frequently Asked Questions

Related Tools

Was this tool helpful?