Encoder
URL Encode / Decode
Percent-encode text for use in a URL, decode an encoded URL back to readable text, or break a URL into its parts.
How to use it
- Choose Encode, Decode or Parse URL.
- When encoding, pick Component for a single query value or path segment, or Full URL for a whole address.
- Turn on Spaces as + for HTML form data (
application/x-www-form-urlencoded).
What percent-encoding does
URLs can only contain a limited set of characters. Others, such as spaces, non-ASCII
letters and characters with special meaning like &, = and
?, are written as % followed by the hex value of each UTF-8 byte.
A space becomes %20, and é becomes %C3%A9.
Component vs full URL
| Component | Full URL | |
|---|---|---|
| JavaScript | encodeURIComponent | encodeURI |
Encodes / ? & = # : | Yes | No |
| Use for | One query value or path segment | A complete URL that already has its structure |
The most common bug is encoding a whole URL with encodeURIComponent, which
breaks it by encoding :// and /, or putting a value with
& into a query string without encoding it, which splits it into two
parameters.
Parsing a URL
Parse URL uses the browser’s URL parser to show the protocol, host, port, path,
query string and fragment, plus a table of decoded query parameters. Repeated parameters
like tags=new&tags=sale are all listed.
Frequently asked questions
Should a space be %20 or +?
Both are common. %20 works everywhere in a URL. + means a space only in form-encoded query strings, so use it when imitating an HTML form submission.
Why do I get "Malformed percent-encoding"?
A % is not followed by two hex digits, or the bytes don’t form valid UTF-8. A literal % sign must itself be encoded as %25.
Do I need to encode letters and numbers?
No. A–Z, a–z, 0–9 and - _ . ~ never need encoding.
Is my data uploaded?
No. Everything runs with JavaScript inside your browser tab. Nothing you paste is sent to a server or stored.