URL Encoder/Decoder — Percent Encode and Decode URLs Online
Our free URL encoder and decoder converts text and URLs to percent-encoded format instantly — and decodes them back to readable text. Paste a URL to analyze its components, encode individual query parameters, or decode a garbled URL full of percent signs. Everything runs in your browser with no data sent to any server.
What Is URL Encoding?
URL encoding, also called percent encoding, is a method of representing special characters in a URL using a percent sign followed by two hexadecimal digits. URLs can only contain a limited set of characters from the ASCII character set. Any character outside this set, or any reserved character used as literal data rather than as a URL delimiter, must be encoded.
For example, if you want to include the search query "hello world & more" as a URL parameter, the space becomes %20 and the ampersand becomes %26, producing: ?q=hello%20world%20%26%20more
URL Encoding Reference — Common Characters
Here are the most frequently encountered characters and their URL-encoded equivalents:
| Character | Encoded | Description |
|---|---|---|
| Space | %20 | Most common encoding need |
| ! | %21 | Exclamation mark |
| " | %22 | Double quote |
| # | %23 | Hash / fragment delimiter |
| $ | %24 | Dollar sign |
| % | %25 | Percent sign itself |
| & | %26 | Ampersand / query param separator |
| ' | %27 | Single quote / apostrophe |
| ( | %28 | Open parenthesis |
| ) | %29 | Close parenthesis |
| * | %2A | Asterisk |
| + | %2B | Plus sign (also means space in forms) |
| , | %2C | Comma |
| / | %2F | Forward slash / path separator |
| : | %3A | Colon |
| ; | %3B | Semicolon |
| = | %3D | Equals sign / param value separator |
| ? | %3F | Question mark / query string start |
| @ | %40 | At sign |
| [ | %5B | Open bracket |
| ] | %5D | Close bracket |
| { | %7B | Open brace |
| } | %7D | Close brace |
encodeURI vs encodeURIComponent
JavaScript provides two built-in functions for URL encoding, each suited to different use cases:
| Function | Preserves | Encodes | Best Used For |
|---|---|---|---|
| encodeURI() | : / ? # [ ] @ ! $ & ' ( ) * + , ; = and unreserved chars | Spaces, Unicode, and other special chars | Encoding a complete URL |
| encodeURIComponent() | A-Z a-z 0-9 - _ . ! ~ * ' ( ) only | All reserved and special chars including & = + # : / | Encoding individual query parameter values |
| decodeURI() | — | — | Decoding a full encoded URL |
| decodeURIComponent() | — | — | Decoding individual encoded values |
URL Structure — Anatomy of a URL
Understanding URL structure helps you know which parts need encoding and which delimiters should be preserved:
| Component | Example | Description |
|---|---|---|
| Protocol | https:// | Communication scheme |
| Host | toolsle.com | Domain name or IP address |
| Port | :8080 | Optional, defaults to 80/443 |
| Path | /tools/url-encoder | Resource location on the server |
| Query | ?q=hello+world&lang=en | Key-value parameters after ? |
| Fragment | #section-2 | Client-side anchor after # |
Common URL Encoding Mistakes
Double Encoding
Double encoding happens when an already-encoded URL is encoded again. For example, encoding %20 produces %2520 — the % itself gets encoded to %25. This causes broken URLs and failed requests. Always decode before re-encoding to avoid this. The URL analyzer in this tool shows if your URL contains double-encoded sequences.
Encoding the Entire URL
A common mistake is using encodeURIComponent() on a full URL, which encodes the : and // in https://, the / path separators, and the ? and & query delimiters, breaking the URL structure. Use encodeURI() for full URLs and encodeURIComponent() only for individual parameter values.
Forgetting to Encode User Input
When building URLs programmatically with user-supplied values, always encode each parameter value separately with encodeURIComponent(). Failing to do so can break URLs when users input characters like &, =, #, or non-ASCII characters.
URL Encoding in Different Languages
| Language | Encode | Decode |
|---|---|---|
| JavaScript | encodeURIComponent(str) | decodeURIComponent(str) |
| Python | urllib.parse.quote(str) | urllib.parse.unquote(str) |
| PHP | urlencode($str) | urldecode($str) |
| Java | URLEncoder.encode(str, "UTF-8") | URLDecoder.decode(str, "UTF-8") |
| C# | Uri.EscapeDataString(str) | Uri.UnescapeDataString(str) |
| Ruby | URI.encode_www_form_component(str) | URI.decode_www_form_component(str) |
| Go | url.QueryEscape(str) | url.QueryUnescape(str) |
| Rust | urlencoding::encode(str) | urlencoding::decode(str) |
Frequently Asked Questions
What does %20 mean in a URL?
%20 is the percent-encoded representation of a space character. The hexadecimal value 20 is the ASCII code for a space. When you see %20 in a URL it means a space was encoded there — for example, "hello%20world" decodes to "hello world".
What is the difference between %20 and + in a URL?
Both represent a space but in different contexts. %20 is the standard percent encoding of a space and works in all URL positions. The + character represents a space only in HTML form data (application/x-www-form-urlencoded format) — specifically in query strings submitted from forms. In path segments, + is a literal plus sign, not a space.
How do I encode a URL in JavaScript?
To encode a full URL use encodeURI(url). To encode a query parameter value use encodeURIComponent(value). For example: const url = 'https://example.com/search?q=' + encodeURIComponent(userInput);
Why does my encoded URL have %C3%A9 in it?
%C3%A9 is the URL encoding of the character é (e with acute accent). Non-ASCII characters like accented letters are first encoded in UTF-8 (which may produce multiple bytes), then each byte is percent-encoded. é in UTF-8 is two bytes: 0xC3 and 0xA9, giving %C3%A9.
Can I use this tool to fix broken URLs?
Yes. If you have a URL with visible percent-encoded sequences like %20 or %3D that should be readable, paste it into Decode mode to see the human-readable version. If you have a URL with special characters that needs to be made safe for use in a browser or API request, paste it into Encode mode.