URL Encoder & Decoder
Encode or decode URLs and query parameters. Supports encodeURI and encodeURIComponent.
Paste a URL to percent-encode special characters for safe transmission, or decode an encoded URL back to readable form. Handles both component and full-URI encoding.
Encode parameter values with component mode, and use full-URI mode only when the URL structure is already in place.
Common Encodings
Why URLs Need Encoding
URLs can only contain a limited set of characters: letters, numbers, and a few special characters like hyphens and underscores. Everything else, spaces, ampersands, question marks, non-ASCII characters, must be "percent-encoded" to travel safely through browsers, servers, and APIs.
Percent-encoding replaces each unsafe character with a % followed by two hex digits. A space becomes %20. An ampersand becomes %26. The Japanese character "ζ±" becomes %E6%9D%B1. It's the postal code of the web, ensuring your data arrives at the right destination without corruption.
This matters more than you think. A URL with an unencoded & in a query parameter can break the entire request. An unencoded space might silently truncate your data. URL encoding prevents these bugs before they happen.
Characters That Need Encoding
| Character | Encoded | Why It's Reserved |
|---|---|---|
| Space | %20 (or +) | Separates URL segments |
| & | %26 | Separates query parameters |
| = | %3D | Separates key from value in params |
| ? | %3F | Marks start of query string |
| # | %23 | Marks fragment/anchor |
| / | %2F | Separates path segments |
| @ | %40 | Used in email/authentication URLs |
| + | %2B | Interpreted as space in form data |
What this means for you: If you're building URLs dynamically (API calls, redirects, tracking links), always encode parameter values. Most programming languages have built-in functions: encodeURIComponent() in JS, urllib.parse.quote() in Python, URLEncoder.encode() in Java.
encodeURI vs encodeURIComponent
encodeURI()
Encodes a full URL but leaves reserved characters (: / ? # @ & = +) intact. Use it when you have a complete URL with spaces or non-ASCII characters in the path.
encodeURIComponent()
Encodes everything except letters, digits, and - _ . ~. Use it for individual query parameter values. This is what you need 90% of the time.
Common Encoding Mistakes
Double encoding
Encoding an already-encoded string turns %20 into %2520. This happens when a framework auto-encodes and you've already encoded manually. Decode first, or let only one layer handle encoding.
Encoding the full URL instead of just the value
Using encodeURIComponent() on an entire URL turns the :// into %3A%2F%2F, breaking the link. Use encodeURI() for full URLs, encodeURIComponent() for individual parameter values only.
Space as + vs %20
HTML forms encode spaces as +, but URLs use %20. If you're building a URL from form data, replace + with %20. Most current APIs expect %20, but some legacy systems still expect +.
Query Parameter Example
The safest pattern is to encode each value, then assemble the URL. The key and structural separators stay readable, while spaces and reserved characters inside the value are protected.
| Part | Raw Value | Encoded Value | Reason |
|---|---|---|---|
| Search term | coffee & tea | coffee%20%26%20tea | The ampersand would otherwise start a new parameter |
| Return URL | https://example.com/a?x=1 | https%3A%2F%2Fexample.com%2Fa%3Fx%3D1 | The nested URL needs to stay inside one value |
| Fragment text | section #2 | section%20%232 | An unencoded # would start a fragment |
A finished URL might look like /search?q=coffee%20%26%20tea. The equal sign and ampersand separators are URL structure, not data.
Path, Query, and Fragment Rules
Path segments
Encode each path segment separately if user text becomes part of a path. A slash inside a name should become %2F, otherwise it creates a new path segment.
Query values
Query values are where encodeURIComponent is most useful. Encode the value, then join it to the key with = and to other parameters with &.
Fragments
The fragment starts after # and is not sent to the server in normal HTTP requests. Encode user text inside it if it contains spaces or punctuation.
Already parsed URLs
If you are writing application code, the URL and URLSearchParams APIs usually handle this better than string concatenation.
Decoding Safely
Decoding makes a URL easier to inspect, but decoded text can change how a browser or server interprets the string. Treat decoded output as a debugging view unless you know the target context.
| Encoded | Decoded | What It Could Change |
|---|---|---|
| %26 | & | May split one query value into two parameters |
| %23 | # | May turn the rest of the URL into a fragment |
| %2F | / | May change a path value into a path separator |
| %2B | + | May be interpreted as a space by form-style decoders |
Troubleshooting URL Bugs
The server sees missing parameters
Look for an unencoded ampersand inside a value. For example, q=R&D is read as q=R plus an empty D parameter unless the ampersand becomes %26.
The link stops halfway through
An unencoded # starts the fragment section. If # is part of the value, encode it as %23 before building the link.
The decoded output still has percent signs
It may be double encoded. Decode once to turn %2520 into %20, then decode again only if you are sure the original data really was encoded twice.
A plus sign became a space
Some form decoders treat + as a space. Encode a literal plus sign as %2B when it needs to survive unchanged.
Encoding Decision Guide
| Task | Encode | Leave Alone |
|---|---|---|
| Add a search term | The query value | The ?q= structure |
| Add a file name to a path | The file name segment | The slash between path segments |
| Nest a return URL | The whole return URL as one value | The outer URL structure |
| Share a readable full URL | Only unsafe characters inside data parts | Protocol, host, path separators, and parameter separators |
When in doubt, identify the smallest data value first, encode that value, then put it back into the URL structure.
Related Tools
How to use this tool
Paste a URL or encoded string
Choose Encode (Component or URI) or Decode
Copy the result
Common uses
- Encoding query parameter values for API calls
- Decoding percent-encoded URLs for debugging
- Preparing redirect URLs with special characters
- Encoding form data for POST requests
- Making URLs safe for sharing and bookmarking
Share this tool
Frequently Asked Questions
What is URL encoding?
What's the difference between encodeURI and encodeURIComponent?
Why does my URL break when I don't encode it?
Should I encode the entire URL or just parts of it?
What's the difference between %20 and + for spaces?
How do I encode URLs in JavaScript?
Can URL encoding handle Unicode and emojis?
Is double-encoding a problem?
What characters don't need encoding in URLs?
How does URL encoding work in different programming languages?
Is anything uploaded while I encode or decode?
What's the maximum URL length I can use?
Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.