webtools

URL Encode

Private: nothing leaves your browser

Result
output

                  

Waiting for text

Percent encode a value so it survives being put in a URL, or escape only the illegal characters in a whole link. Pick the scope and the result appears as you type, ready to paste into a query string.

About encoding for a URL

A URL can only carry a limited set of characters, and a handful of those have a job to do: ? opens the query, & separates parameters, = splits a name from its value, # starts the fragment. Anything else, and any of those used as data rather than as punctuation, has to be written as a percent sign and two hex digits.

The choice that matters here is scope, and getting it wrong is the most common bug in hand built URLs. One value escapes everything that is not a plain unreserved character, which is what a single query parameter or path segment needs: an ampersand in "Rutvik & Co" becomes %26 instead of silently splitting your query string in two. A whole URL leaves the structure alone and fixes only what is outright illegal, such as spaces and accented letters, so https:// stays intact rather than turning into https%3A%2F%2F.

This escapes a little more than the browser's own encodeURIComponent does. That function leaves !, ', (, ) and * alone even though RFC 3986 reserves them. Most servers do not care, but request signing schemes such as the ones used by AWS and several payment gateways do, and an unescaped apostrophe in a signed string is a hard bug to find. Escaping more than strictly necessary is always safe. It is the wrong answer for a readable path, though: nobody wants %20 in a page address, so a title heading for a URL wants the slug tool instead.

How to URL encode a value

  1. Type or paste the value. The encoded version appears as you go.
  2. Choose the Scope: One value for a query parameter, A whole URL for a complete link.
  3. Press Copy and paste it into your query string, form or config.
  4. Paste something that already has percent escapes in it and the direction flips on its own, so you see the decoded text.
  5. Press Result to input to check the value decodes back to exactly what you started with.

Common questions about URL encoding

Is the value I encode kept or logged?

No. The encoding happens in JavaScript on this page, so customer names, references and tokens stay on your own device. Nothing is sent, logged or saved, and the page keeps working with your connection switched off.

Which scope should I pick?

If you are building one parameter, choose One value. If you already have a finished link and just want it to be legal, choose A whole URL. Running a whole URL through the first option breaks it, and running a single value through the second leaves separators in your data, which quietly corrupts the query string.

Should a space be %20 or a plus sign?

%20 is correct everywhere: in a path, in a query, in a header. The plus sign only means a space inside application/x-www-form-urlencoded, which is what an HTML form posts. This page always produces %20, which is the safe choice, and a server that expects form encoding still reads it correctly.

Do I need to encode a slash or a colon?

Inside a value, yes: a slash in a parameter would otherwise read as part of a path, so it becomes %2F. As part of the URL's own structure, no, which is why the two scopes exist. If a path segment itself contains a slash as data, that segment has to be encoded as a value before it is joined into the URL.

What about Hindi, Gujarati or emoji?

They encode as their UTF-8 bytes, so one character can become three or four escapes. That is correct and every modern server decodes it. Browsers often display such URLs in their readable form in the address bar, but what actually travels over the wire is the escaped version this page produces.

Next

Related tools

All Dev tools