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.
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:
| Character | Encoded | Reason |
|---|---|---|
| Space | %20 (or +) | Not allowed in URLs |
| & | %26 | Used as query parameter separator |
| = | %3D | Used as key=value separator |
| # | %23 | Used as fragment identifier |
| ? | %3F | Starts query string |
| / | %2F | Path separator |
| @ | %40 | Used in userinfo |
| + | %2B | When literal + needed (vs space) |
| " | %22 | Not URL-safe |
| < | %3C | Not URL-safe |
| > | %3E | Not URL-safe |
-, _, ., ~
How to Use It
Encoding:- Open CalcHub and go to URL Encoder.
- Choose what you're encoding:
- Paste text and copy encoded output.
- Switch to Decode mode.
- Paste the encoded URL or text.
- Readable text appears immediately.
Full URL vs. Component Encoding
This is the most common source of confusion:
| Input | Full URL encode | Component encode |
|---|---|---|
https://example.com/search?q=hello world | https://example.com/search?q=hello%20world | https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world |
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