URL Encode, Decode and Parse
Encode and decode URLs, and split them into parts.
About this tool
Percent-encode text for use in a URL, decode it back, or break a full URL into protocol, host, path, query parameters and fragment, with every parameter decoded.
How to use it
- Choose Parse URL to split a link into its parts, or Encode / Decode for percent-encoding.
- Paste a URL or text.
- In Parse mode, read the protocol, host, path and every query parameter already decoded.
- Copy any part you need.
Questions
- What is the difference between encodeURI and encodeURIComponent?
- encodeURIComponent escapes everything that has a meaning in a URL, including / ? & and =, so use it for a single parameter value. encodeURI keeps those characters so a whole URL stays usable. The Keep option switches between them.
- Why is a space sometimes + and sometimes %20?
- In query strings from HTML forms a space is written as +; elsewhere in a URL it is %20. Turn on “Treat + as space” when decoding form data.
- What does “broken percent-escape” mean?
- A % must be followed by two hex digits, and multi-byte characters need all their bytes. Text cut in the middle of an escape, like %E2%82, can’t be decoded.
- Should the URL path be encoded differently from the query?
- Mostly the same rules apply, with two differences. In the path, / separates segments, so encode each segment on its own and a slash inside a name becomes %2F. And + is a literal plus in the path, while form-encoded query strings read it as a space.
- How long can a URL be?
- The standards set no limit, but practical ones apply. Browsers handle very long URLs, while servers, proxies and CDNs often cap the request line at around 8 KB and answer 414 URI Too Long. Keep URLs under about 2,000 characters and send large data in a POST body.
- Is it safe to put tokens or email addresses in a URL?
- Avoid it. URLs end up in server logs, proxy logs, browser history and the Referer header sent to other sites. Percent-encoding hides nothing, since anyone can decode it. Send tokens in an Authorization header and personal data in a POST body instead.
What is URL encoding (percent-encoding)?
URL encoding, or percent-encoding, replaces characters that aren’t allowed or have a special meaning in a URL with a % sign and two hex digits. A space becomes %20, & becomes %26 and / becomes %2F. The rules come from RFC 3986, which lists the unreserved characters that never need encoding: ASCII letters, digits, and - . _ ~. Everything else may need escaping, depending on which part of the URL it appears in.
Non-ASCII text is first converted to UTF-8 bytes, and each byte is encoded separately. That is why “é” becomes %C3%A9 and the rocket emoji becomes four escapes, %F0%9F%9A%80. When decoding, all bytes of a character must be present. This tool uses the standard encodeURIComponent, encodeURI and decodeURIComponent functions in your browser, so the URL encode and decode results match what JavaScript code produces.
How to parse a URL and read its query parameters
Parse URL mode splits a link into the parts defined by the URL standard: protocol, username, host, port, path, query, fragment and origin, each with its own copy button. The query string is broken into name and value pairs with every value decoded, so ?q=running%20shoes shows up as running shoes. If a parameter appears more than once, like color=black&color=white, each occurrence gets its own row.
The parser needs a full URL including the scheme, so example.com/path fails while https://example.com/path works. A password in the URL is masked in the parts table. In code, the same parsing is available as new URL(link) with url.searchParams in browsers and Node.js, or urllib.parse in Python. When the link comes from a curl command, the curl Converter turns the whole request into fetch or Python.
Why does my URL break? Common encoding mistakes
The classic bug is building a URL by concatenating raw values. A search term like R&D sent as ?q=R&D becomes q=R plus a second, empty parameter named D. Encode each value on its own with encodeURIComponent, or let URLSearchParams build the query string for you. Never run a whole URL through encodeURIComponent, because it also escapes the colon and slashes that the URL needs to work.
The opposite bug is double encoding. A value encoded twice turns % into %25, so a space becomes %2520 and still reads %20 after one decode. If you see %25 in a URL, decode once and check whether the result still contains escapes. Also watch the plus sign: in a query string it is often read as a space, so encode a literal + as %2B.
Something not working, or a result looks wrong? Report a problem with this tool