URL encoder and decoder for links and query strings.
Percent-encode or decode text, query strings and full URLs, and see every part of a URL broken down. Runs in your browser.
33 characters
Free and private: this tool runs entirely in your browser.Need a fast website or web app? Talk to TechnoHelp
How to use the URL encoder & decoder
Choose Encode or Decode
Encode turns spaces, accents and symbols into %XX sequences. Decode turns them back into readable text.
Pick the type
Use Component for a single query value or path segment. Use Full URL to fix a whole address while keeping : / ? # & = intact.
Paste your text
The result updates as you type. Turn on Spaces as + for HTML form data, or Each line separately to convert a list of values at once.
Copy, swap or inspect
Copy the result or press Ctrl / ⌘ + Enter. Swap sends the output back to the input to check a round trip. Paste a full URL to see its host, path and decoded query parameters.
What is percent-encoding?
URLs can only contain a small set of ASCII characters. Anything else is written as a % sign followed by two hex digits for each byte.
space → %20
é → UTF-8 bytes C3 A9 → %C3%A9
& inside a value → %26
RFC 3986 sorts characters into groups. Reserved characters have a job in the URL’s structure, so they must be encoded when they appear inside data. A literal % must always be written as %25.
| Group | Characters | Rule |
|---|---|---|
| Unreserved | A–Z a–z 0–9 - . _ ~ | Never need encoding. Encoding them doesn’t change the meaning of a URL. |
| Reserved: general delimiters | : / ? # [ ] @ | Separate the scheme, host, path, query and fragment. Encode them when they are part of a value. |
| Reserved: sub-delimiters | ! $ & ' ( ) * + , ; = | Separate items inside a part, like & and = in a query string. Encode them inside a value. |
| Everything else | space % " < > \ ^ ` { | } é 😀 … | Always encoded. Non-ASCII characters are converted to UTF-8 bytes first. |
encodeURI vs encodeURIComponent.
JavaScript has two built-in encoders. The difference is which reserved characters they leave alone.
- encodeURIComponent
- Leaves as isA–Z a–z 0–9 - _ . ! ~ * ' ( )Use it forA single query value or path segment, like a search term or a file nameExamplea/b?c=1&d → a%2Fb%3Fc%3D1%26d
- encodeURI
- Leaves as isThe same, plus ; / ? : @ & = + $ , #Use it forA whole URL that only needs spaces and other unsafe characters fixedExamplea/b?c=1&d → a/b?c=1&d
Encoding a whole URL with encodeURIComponent breaks it, because the slashes and colon get encoded too. Encoding a query value with encodeURI is the opposite mistake: a value containing & or = would split into extra parameters. See MDN for encodeURIComponent and encodeURI.
When + means a space.
In HTML form data, a space is written as +. Everywhere else in a URL, + is just a plus sign.
When a form is submitted with GET, the browser builds the query string in the application/x-www-form-urlencoded format, which turns spaces into + and a real plus sign into %2B. URLSearchParams in JavaScript uses the same format, and also encodes a few characters that encodeURIComponent leaves alone, such as ! ' ( ) ~.
Form / URLSearchParams: ?q=red+shoes
encodeURIComponent: ?q=red%20shoes
Both forms mean “red shoes” in a query string. But decodeURIComponent doesn’t convert + to a space, so decode form data with + as space turned on. In a path, %20 is the only correct way to write a space.
Frequently asked questions.
What is URL encoding?
URL encoding, or percent-encoding, replaces characters that aren’t allowed in a URL with a % sign and two hex digits per byte. For example, a space becomes %20 and é becomes %C3%A9, its two UTF-8 bytes.
Should a space be encoded as %20 or +?
Use %20 in paths and in general. The + form only means a space in query strings that use the HTML form format (application/x-www-form-urlencoded). If you are not sure how the server reads the query, %20 is the safer choice.
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent encodes every reserved character, including / ? : & and =, so it is right for a single query value or path segment. encodeURI leaves those characters alone so a full URL keeps working, and only encodes spaces, non-ASCII letters and other unsafe characters.
Which characters need to be encoded in a URL?
Letters, digits and - . _ ~ never need encoding. Reserved characters like : / ? # & = + need encoding when they are part of a value rather than the URL’s structure. Spaces, quotes, angle brackets, % itself and all non-ASCII characters are always encoded.
Why does decoding fail with a malformed URI error?
JavaScript’s decodeURIComponent throws a URIError when a % isn’t followed by two hex digits, as in %ZZ, or when the bytes don’t form valid UTF-8, as in the cut-off sequence %E0%A4%A. This tool shows which escape is wrong and where it is. A literal % in the original text should have been encoded as %25.
Should I encode the whole URL or only the query parameters?
Encode each query value or path segment on its own with Component encoding, then join them with the URL’s / ? & and = characters. Encode a whole URL with Full URL mode only when it is already put together and just needs spaces or accented letters fixed.
Is URL encoding a form of encryption?
No. Percent-encoding only makes text safe to put in a URL, and anyone can decode it. Don’t put passwords, tokens or personal data in URLs, because they can end up in browser history and server logs.
Is my text sent to a server?
No. Encoding, decoding and URL inspection run entirely in your browser with built-in JavaScript, and nothing you paste is uploaded or stored.
From the team behind these tools
Messy URLs on your website?
TechnoHelp is an independent web design and development studio. We build fast, secure and scalable websites and web apps with clean, readable URLs.