Developer Tools

URL Encoder / Decoder

URL encoder and decoder: percent-encode a query value or a whole URL, decode %20-style strings back to text, and see each query parameter split out.

Input

This URL encoder percent-encodes text for use in URLs, and its URL decoder turns percent-encoded strings back into readable text. The default mode uses JavaScript's encodeURIComponent, which escapes everything except ASCII letters, digits and - _ . ! ~ * ' ( ), and suits a single query value or path segment. Ticking "Encode full URL" switches to encodeURI, which also leaves : / ? & = # and the other URL delimiters alone. Both tabs update as you type, in your browser.

How to use the URL encoder and decoder

  1. On the Encode tab, paste text into Text or URL to Encode. Encoded Output fills in as you type, or press Encode.
  2. Tick Encode full URL if the input is a whole address whose slashes, question mark and ampersands must survive. Leave it unticked for a single value.
  3. Press Copy Encoded. The note beside it shows the length change, for example 12 chars to 18 chars for fish & chips.
  4. To decode, open the Decode tab, paste the string into URL-Encoded String to Decode, and copy the result with Copy Decoded.

Component or full URL: which characters change

CharacterDefault modeEncode full URL
space%20%20
&%26&
/%2F/
?%3F?
=%3D=
#%23#
+%2B+
%%25%25
é%C3%A9%C3%A9

Each escape is a percent sign followed by the byte's value in hex. Non-ASCII text is encoded as UTF-8 bytes, so é becomes two escapes and café €5 becomes caf%C3%A9%20%E2%82%AC5.

Example: one query string in both modes

Input:
https://example.com/search?q=fish & chips

Default mode:
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dfish%20%26%20chips

Encode full URL ticked:
https://example.com/search?q=fish%20&%20chips

The default mode escaped the slashes and the question mark, so the result is no longer a usable address. Full URL mode left the ampersand alone, so a server reads q as "fish " plus a second, empty parameter named " chips". The component breakdown table under the output shows that split. Encode only the value instead: fish & chips becomes fish%20%26%20chips, which gives https://example.com/search?q=fish%20%26%20chips.

Common uses

Typical jobs are building query strings by hand, for an API request or a UTM-tagged link whose campaign name contains spaces or an ampersand, and reading redirect or tracking URLs that carry a second URL percent-encoded inside a parameter. To see where such a link finally lands, the redirect checker follows each hop from its server. For a readable path segment made from a page title, the URL slug generator strips punctuation and joins the words with a separator.

Percent-encoding is different from Base64. When an API wants binary data or a token inside a URL, it usually means base64url, which the Base64 tool produces with its URL-safe option, and the explainer on Base64 encoding covers how base64url differs from standard Base64. More tools of this kind are in the developer tools section.

URL encoding in code, compared with this URL encoder

The URL encoder's default mode gives the same result as these standard functions for most text. Java's URLEncoder is the odd one out, because it follows HTML form rules and writes a space as +:

JavaScript  encodeURIComponent("fish & chips")          fish%20%26%20chips
PHP         rawurlencode("fish & chips")                fish%20%26%20chips
Python      urllib.parse.quote("fish & chips", safe="") fish%20%26%20chips
C#          Uri.EscapeDataString("fish & chips")        fish%20%26%20chips
Java        URLEncoder.encode("fish & chips", UTF_8)    fish+%26+chips

Python's quote() leaves slashes alone unless you pass safe="", so a/b c becomes a/b%20c by default. PHP's rawurlencode() also escapes ! * ' ( ), which this URL encoder leaves as they are.

Behaviour to watch for

  • The decoder turns every + into a space before decoding, as HTML forms do. C%2B%2B+tips decodes to "C++ tips", while an unencoded plus in 1+1=2 comes back as "1 1=2".
  • Full URL mode encodes the percent sign too, so an address that is already encoded gets encoded twice: a%20b becomes a%2520b. If in doubt, decode it first.

Frequently Asked Questions

Should a space in a URL be encoded as %20 or +?
Use %20, which stands for a space anywhere in a URL. The + form comes from HTML form submissions and only means a space inside a query string, which is why PHP's urlencode function produces it. This encoder always writes %20, and its decoder reads both forms back as spaces.
Is this URL encoder RFC 3986 compliant?
Nearly. The default mode leaves the characters ! * ' ( ) unescaped, while RFC 3986 lists them as reserved. Most servers accept them as they are, but OAuth 1.0 signature base strings and AWS Signature Version 4 require them as %21, %2A, %27, %28 and %29, so replace those by hand when you are signing requests.
Why does decoding show an Invalid encoding error?
Decoding stops when a percent sign is not followed by two hex digits, as in 100%, or when an escape sequence is cut short, like %E2%82, which is the start of a three-byte character. Strings escaped in Latin-1 by older systems, such as %E9 for é, fail as well because the decoder expects UTF-8. Replace a stray percent sign with %25 and try again.
What does the URL component breakdown show?
It appears when Encode full URL is ticked and the input starts with http:// or https://. The table lists the protocol, host, port, path, whole query string, each query parameter by name and the fragment, with a raw column and an encoded column. The parameter rows show how a server will split the query, which makes an unescaped ampersand inside a value easy to spot.
What does %20 mean in a URL?
It is an encoded space. Percent-encoding writes a byte as % followed by its two-digit hex value, and a space is byte 20 in hex (32 in decimal). In the same way %26 is an ampersand, %2F a slash and %25 a literal percent sign.
Is it safe to URL encode online with this tool?
Yes. Encoding and decoding run in JavaScript inside the page, and the text you paste is not sent to a server or stored. That matters when a URL carries an API key, a session token or customer details in its query string.