March 26, 20263 min read

URL Encoder Decoder — Encode and Decode URLs and Query Strings

Encode special characters in URLs to percent-encoding format and decode percent-encoded URLs back to readable text. Handles full URLs and individual components.

URL encoder URL decoder percent encoding web tools calchub
Ad 336x280

URLs have a limited set of characters they can contain without encoding. Spaces, ampersands, equals signs, and most other punctuation need to be percent-encoded before they're valid in a URL. You've seen this in action: a Google search for "hello world" appears in the address bar as ?q=hello+world or ?q=hello%20world. The CalcHub URL Encoder Decoder handles both directions and explains what's happening.

How Percent Encoding Works

Characters that aren't "URL-safe" are replaced by a % followed by their hex value:

CharacterEncodedReason
Space%20 (or +)Not allowed in URLs
&%26Used as query parameter separator
=%3DUsed as key=value separator
#%23Used as fragment identifier
?%3FStarts query string
/%2FPath separator
@%40Used in userinfo
+%2BWhen literal + needed (vs space)
"%22Not URL-safe
<%3CNot URL-safe
>%3ENot URL-safe
Safe characters (never encoded): A–Z, a–z, 0–9, -, _, ., ~

How to Use It

Encoding:
  1. Open CalcHub and go to URL Encoder.
  2. Choose what you're encoding:
- Full URL: Encodes only the query parameter values, preserving /, ?, &, = structure - URL component: Encodes everything including /, ?, & (for embedding a URL inside another) - Query string value: Encodes just a single parameter value
  1. Paste text and copy encoded output.
Decoding:
  1. Switch to Decode mode.
  2. Paste the encoded URL or text.
  3. Readable text appears immediately.

Full URL vs. Component Encoding

This is the most common source of confusion:

InputFull URL encodeComponent encode
https://example.com/search?q=hello worldhttps://example.com/search?q=hello%20worldhttps%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world
Use full URL encoding when the URL will be used as-is in a browser. Use component encoding when the entire URL is being embedded as a value inside another URL (e.g., a redirect parameter).

Common Real-World Uses

  • Building query strings: Encoding user input before appending to a URL
  • Debugging redirects: Decoding percent-encoded URLs in logs or error messages
  • API work: Encoding parameters in API requests
  • Email links: Mailto links with subject/body need URL encoding
  • SEO analysis: Reading encoded URLs in analytics reports

What's the difference between %20 and + for spaces?

Both represent a space, but in different contexts. %20 works everywhere; + for spaces is valid only in query strings (the application/x-www-form-urlencoded format). When in doubt, use %20 — it's always safe.

Why does %2F (/) cause problems in some paths?

Some web servers and frameworks treat %2F in the path as a literal slash, while others treat it as an encoded slash distinct from the path separator. Django, for example, blocks %2F in paths by default. If you're encoding a path segment that shouldn't be interpreted as a directory separator, check your framework's behavior.

Can I decode a URL that's been double-encoded?

Yes. Double-encoding happens when a URL is encoded twice: a space becomes %20, then the % itself gets encoded to %2520, resulting in %2520 in the string. The decoder has a "decode once" and "decode all layers" mode to handle this.


Related tools: HTML Entity Encoder · Base64 Encoder Decoder · Slug Generator
Ad 728x90