URL Encoder & Decoder Online
Percent-encode or decode URLs and query parameters safely.
A URL encoder replaces characters that are unsafe or meaningful in a URL with a % sign and two hex digits per UTF-8 byte, so a space becomes %20 and é becomes %C3%A9. Choose the mode by where the text is going: Component for one query value or path segment, Full URI for a complete URL, and Form for HTML form data, which writes spaces as +.
Encoded
https%3A%2F%2Fveojson.com%2Ftools%3Fq%3Dhello%20world%26lang%3Dfr
Decoded
https://veojson.com/tools?q=hello world&lang=fr
Join the Veojson dispatch
Get the weekly Veojson dispatch on API design, encoding gotchas and developer tooling.
One email, no spam, unsubscribe any time.
About this tool
Percent encoding replaces unsafe characters with a % followed by two hex digits so they survive transport in a URL. This tool runs encodeURIComponent and decodeURIComponent (plus full-URI variants) locally in your browser.
Component vs full URI
Use component mode for a single query value — it escapes &, =, ? and /. Use full URI mode when encoding a complete address you do not want to break.
Spaces and plus signs
Percent encoding turns a space into %20. Some form encoders use + instead; decode with the matching mode or you will get literal plus characters back.
encodeURI vs encodeURIComponent
encodeURI expects a whole URL, so it leaves the characters that give a URL its structure (: / ? # & = + $ , ; @) alone and only escapes spaces, quotes, non-ASCII text and similar. encodeURIComponent expects one piece of a URL, so it escapes those structural characters too. That is why encoding a query value with encodeURI is a bug: a value of a&b=c stays a&b=c and the server reads it as two parameters. The reverse mistake, passing a finished URL to encodeURIComponent, turns https:// into https%3A%2F%2F. Build URLs from parts and encode each part with encodeURIComponent, or let URLSearchParams build the query string for you.
%20 or + for spaces
Both are correct, in different places. RFC 3986 percent-encoding, which encodeURIComponent and encodeURI follow, writes a space as %20 and treats + as a literal plus sign. The application/x-www-form-urlencoded format used by HTML form submissions and URLSearchParams writes a space as + and encodes a real plus as %2B. A form decoder reads both %20 and + as a space, so %20 is the safer choice when you are not sure how the receiver decodes. The bug to watch for is an unencoded + inside a value, such as a phone number like +44 or a base64 string: a form decoder turns it into a space.
Double encoding and how to spot it
Double encoding happens when text that is already encoded gets encoded again. The % in %20 is itself escaped to %25, so a space ends up as %2520 and the server receives the literal characters %20 instead of a space. Typical causes are encoding a value by hand and then passing it to an HTTP client or URLSearchParams that encodes it again, or running encodeURI over a URL that already contains escapes. The tell-tale sign is %25 followed by two hex digits in the final URL. The fix is to encode exactly once, at the point where the URL is assembled, rather than to add a second decode on the server: decoding twice can turn a legitimate %2F into a slash or a real %25 into a stray %.
Non-ASCII text, emoji and decoding errors
Text is converted to UTF-8 bytes before encoding and each byte is escaped, so é (two bytes) becomes %C3%A9 and 😀 (four bytes) becomes %F0%9F%98%80. Decoding fails with a URIError when the input is not valid percent-encoded UTF-8: a lone % such as 100%, an incomplete escape such as %A, or a Latin-1 escape such as %E9 produced by an old system. Find the offending sequence and fix it at the source rather than stripping it.
URL encoding modes compared
| Mode | JavaScript | Space becomes | Also left unescaped (besides A-Z a-z 0-9) | Use for |
|---|---|---|---|---|
| Component | encodeURIComponent() | %20 | ! ' ( ) * - . _ ~ | One query value, path segment or fragment you are inserting into a URL |
| Full URI | encodeURI() | %20 | ! # $ & ' ( ) * + , - . / : ; = ? @ _ ~ | A complete URL that is already structured and only needs unsafe characters fixed |
| Form | URLSearchParams | + | * - . _ | HTML form posts and application/x-www-form-urlencoded request bodies |
Worked examples: the same input in each mode
| Input | encodeURIComponent | encodeURI | Form (URLSearchParams) |
|---|---|---|---|
| hello world | hello%20world | hello%20world | hello+world |
| a&b=c | a%26b%3Dc | a&b=c | a%26b%3Dc |
| 1+1=2 | 1%2B1%3D2 | 1+1=2 | 1%2B1%3D2 |
| /path/to file?x=1 | %2Fpath%2Fto%20file%3Fx%3D1 | /path/to%20file?x=1 | %2Fpath%2Fto+file%3Fx%3D1 |
| café ☕ | caf%C3%A9%20%E2%98%95 | caf%C3%A9%20%E2%98%95 | caf%C3%A9+%E2%98%95 |
| a%20b | a%2520b | a%2520b | a%2520b |
The same two encodings in other languages
| Language | Space as %20 | Space as + (form) |
|---|---|---|
| JavaScript | encodeURIComponent(s) | new URLSearchParams({ k: s }).toString() |
| Python | urllib.parse.quote(s, safe="") | urllib.parse.quote_plus(s), urlencode() |
| PHP | rawurlencode($s) | urlencode($s), http_build_query() |
| Go | url.PathEscape(s) | url.QueryEscape(s) |
| Java | URLEncoder.encode(s, UTF_8).replace("+", "%20") | URLEncoder.encode(s, StandardCharsets.UTF_8) |
How to use URL Encoder & Decoder
- 1
Paste your text
Add a URL, a query parameter or an already-encoded string.
- 2
Choose the mode
Component encodes a single parameter (encodeURIComponent); Full URI encodes a whole URL (encodeURI); Form uses + for spaces like an HTML form.
- 3
Copy the output
The encoded or decoded result is ready to paste into your code or browser bar.
- 4
Troubleshoot decoding
If decoding fails, look for a % that is not followed by two hexadecimal digits — that is the usual cause.
Best practices
- Work from a real payload, not a hand-typed sample — encoding bugs hide in whitespace and Unicode.
- Keep the transformation reproducible: script it in CI once you have confirmed the output here.
- Never paste live credentials, customer records or production tokens into any web tool you have not audited.
- Version the inputs and outputs you rely on so a teammate can reproduce the same result later.
URL Encoder & Decoder — Why it matters
Small integration details — an encoding, a claim, a header — are where most API bugs actually live, and they are expensive to find in production logs.
Getting them right in seconds keeps debugging sessions short and prevents malformed data from reaching downstream systems.
Related free & paid tools
| Tool name | Type | Key features | Link |
|---|---|---|---|
| MDN encodeURIComponent | Free | The exact semantics your browser applies | Visit |
| CyberChef | Free | URL, HTML and double-encoding recipes | Visit |
| PostmanOffer | Freemium | Automatically encodes query params and paths | Visit |
Some links marked Offer are partner links. They cost you nothing extra and help keep these tools free.