FilesCalcs

URL encode and decode

Encode text for use in a web address, decode %20-style links back to readable text, and split any URL into its parts with a table of query parameters.

Worked out in your browser. Nothing is sent anywhere.

How to encode and decode a URL

  1. Paste a URL or a piece of text.
  2. Choose encode as a whole URL or as a component, or choose decode.
  3. Copy the result.
  4. To inspect a link, paste it in and read the parts and query parameter table.

Whole URL or component: encodeURI vs encodeURIComponent

Some characters have a job inside a web address. The / separates folders, ? starts the query string, & separates parameters, = joins a name to its value and # marks a section of the page. The two encoding modes treat them differently.

  • Whole URL (encodeURI) keeps those structural characters as they are and encodes only characters that cannot appear in a URL at all, such as spaces and £. Use it on a complete address you want to make valid.
  • Component (encodeURIComponent) encodes the structural characters too. Use it on a single value you are placing inside a URL, such as a search term or a redirect address.

Here is why it matters. If a search value is "fish & chips" and you encode it as a whole URL, the & survives and the server reads a second parameter called " chips". Encoded as a component it becomes fish%20%26%20chips, and arrives intact.

Reading percent-encoded links

Encoded characters appear as % followed by two hex digits for each byte. A space is %20, & is %26 and / is %2F. Characters beyond basic English take more than one byte in UTF-8, so £ becomes %C2%A3.

In form submissions and many query strings a space is written as + instead of %20. Both mean a space in that part of the URL.

The parts view splits a link into protocol, host, path, query and fragment, and lists each query parameter with its decoded value. That makes it easy to spot tracking tags such as utm_source, check a redirect target, or find the one parameter that breaks a link.

Questions people ask

What does %20 mean in a URL?

%20 is an encoded space. Spaces are not allowed in web addresses, so they are written as %20, or sometimes as + in query strings.

When should I use encodeURIComponent?

Use it for any single value you insert into a URL, such as a query parameter or a path segment. It encodes characters like &, = and / that would otherwise change how the URL is read.

Why is my link encoded twice?

If you encode text that is already encoded, % becomes %25, so %20 turns into %2520. Decode once to get back to the single encoded version.

Is URL encoding the same as Base64?

No. URL encoding replaces only unsafe characters with % codes and leaves the rest readable. Base64 rewrites all the data into a different set of characters.

How is £ encoded in a URL?

As %C2%A3, the two bytes that make up the £ sign in UTF-8.