URL Encode / Decode

Percent-encode, decode and parse URLs and query strings.

Runs in your browser Instant No sign-up
Mode
Style
Input
Result

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use the URL encoder and decoder

  1. Choose Mode: Encode, Decode or Parse URL.
  2. Choose a Style for encoding and decoding: Component, Full URI or Form (+).
  3. Paste text into the left pane. The result updates as you type.
  4. Turn on Each line separately to encode a list of values, one per line. When decoding, each line is always decoded on its own.

Which characters get encoded

Input Style Output
a b&c=d/é? Component a%20b%26c%3Dd%2F%C3%A9%3F
a b&c=d/é? Form (+) a+b%26c%3Dd%2F%C3%A9%3F
https://example.com/a b?q=café&x=1#top Full URI https://example.com/a%20b?q=caf%C3%A9&x=1#top

Use Component for anything you insert into a URL, such as a search term, a redirect target or a path segment. It escapes &, =, /, ? and #, which would otherwise change the meaning of the URL. Full URI is for tidying a complete URL that already has the right structure.

When decoding, Form (+) turns + into a space first. With Component, a+b%26c decodes to a+b&c, and with Form (+) it becomes a b&c. Malformed input is reported clearly, for example: Malformed escape at position 4: '%' must be followed by two hex digits.

Parse a URL into parts

Parse URL splits an absolute URL into its protocol, host, port, path, query parameters and fragment, and returns JSON. Values are decoded, and repeated parameters become arrays. The sample URL produces (shown condensed):

{
  "protocol": "https",
  "host": "example.com",
  "path": "/search",
  "query": { "q": "json formatter", "lang": "vi", "tags": ["a", "b"] },
  "fragment": "results"
}

A password in the URL is masked as ••••.

Parse URL is useful when debugging OAuth and single sign-on redirects. A callback such as https://app.example.com/callback?code=abc123&state=xyz%20k#access_token=eyJ… splits into the code, the decoded state (xyz k) and the raw fragment. Paste the access token from the fragment into the JWT Decoder to read its claims and expiry. Relative URLs such as example.com/x are rejected, because there is no protocol to parse against.

Common pitfalls

  • Encoding a whole URL with Component. https:// becomes https%3A%2F%2F and the link breaks. Encode only the values you insert, or use Full URI for a complete URL.
  • Building query strings by hand. Concatenating ?q= + value forgets to escape & and #. Let URLSearchParams or your HTTP client build the query.
  • Decoding twice. Decoding an already-decoded value can turn a literal %41 in user input into A. Decode exactly once, at the boundary where the data enters your code.

URL encoding in code

encodeURIComponent('a b&c');                 // "a%20b%26c"
new URLSearchParams({ q: 'a b' }).toString(); // "q=a+b"  (form style)
const url = new URL('https://x.dev/?tags=a&tags=b');
url.searchParams.getAll('tags');              // ["a", "b"]
from urllib.parse import quote, quote_plus, unquote, urlparse, parse_qs
quote("a b&c", safe="")   # 'a%20b%26c'
quote_plus("a b&c")       # 'a+b%26c'
parse_qs(urlparse(url).query)

To embed binary data in a URL, encode it with Base64 using the URL-safe alphabet. To escape text for HTML attributes rather than URLs, use HTML Entities.

Frequently asked questions

What is the difference between Component, Full URI and Form encoding?

Component (encodeURIComponent) escapes everything except letters, digits and - _ . ! ~ * ' ( ), so it is the right choice for a single query value or path segment. Full URI (encodeURI) keeps reserved characters such as : / ? & = # so a whole URL stays usable. Form follows application/x-www-form-urlencoded and writes spaces as + instead of %20.

Why does %20 sometimes appear as %2520?

That is double encoding: the % of an already-encoded %20 was encoded again as %25. Decode once to see %20, and decode again to get the space. Double encoding usually means a value was encoded both by your code and by a library, so remove one of the two steps.

Should a space become %20 or +?

Both are valid in different places. In query strings sent by HTML forms, + means a space. In paths and most other parts of a URL, + is a literal plus sign and a space must be %20. Pick Form (+) only for form-style query data.

Can it decode non-ASCII characters?

Yes. Percent-encoded UTF-8 sequences such as %C3%A9 decode to é. A lone % that is not followed by two hex digits, or an invalid UTF-8 sequence, is reported as an error with its position.

Is my URL uploaded?

No. Encoding, decoding and parsing run in your browser, and nothing is uploaded. URLs often contain tokens and personal data, so this matters.

Last updated