Skip to content

URL encoder and decoder

Percent-encode text for use in URLs, decode encoded URLs, and see every part of a URL at a glance.

Mode

Paste a full URL (starting with https://) to see its parts and parameters.

How it works

Anatomy of a URL

https://user@example.com:8080/docs/page?lang=en&q=json#intro

  • Protocol: https:
  • User info: user@ (rare, and a security risk in links)
  • Host and port: example.com:8080
  • Path: /docs/page
  • Query: ?lang=en&q=json, a list of name=value pairs
  • Fragment: #intro, which stays in the browser and is never sent to the server

Characters that need encoding

Letters, digits and - _ . ~ are always safe. Characters with a special meaning, such as ? & = # /, must be encoded when they're part of a value, and everything else (spaces, accented letters, emoji) is encoded as UTF-8 bytes.

Percent-encoding reference

Each character as a % and its UTF-8 bytes in hexadecimal, and what JavaScript's encodeURIComponent (Encode value above) and encodeURI (Encode full URL) make of it. The last two columns come straight from those functions, not from a list typed by hand.

CharacterEncodedencodeURIComponentencodeURI
Space%20%20%20
!Exclamation mark%21unchangedunchanged
"Double quote%22%22%22
#Hash%23%23unchanged
$Dollar sign%24%24unchanged
%Percent sign%25%25%25
&Ampersand%26%26unchanged
'Apostrophe%27unchangedunchanged
(Opening bracket%28unchangedunchanged
)Closing bracket%29unchangedunchanged
*Asterisk%2Aunchangedunchanged
+Plus sign%2B%2Bunchanged
,Comma%2C%2Cunchanged
/Slash%2F%2Funchanged
:Colon%3A%3Aunchanged
;Semicolon%3B%3Bunchanged
<Less than%3C%3C%3C
=Equals sign%3D%3Dunchanged
>Greater than%3E%3E%3E
?Question mark%3F%3Funchanged
@At sign%40%40unchanged
[Opening square bracket%5B%5B%5B
]Closing square bracket%5D%5D%5D
éAccented letter (2 bytes)%C3%A9%C3%A9%C3%A9
€Euro sign (3 bytes)%E2%82%AC%E2%82%AC%E2%82%AC

URL encoding in other languages

Every language has two flavours. Percent-encoding writes a space as %20 and works anywhere in a URL. Form encoding (application/x-www-form-urlencoded, what HTML forms send) writes it as +, which only means a space in a query string.

LanguageFunctionSpace becomes
JavaScriptencodeURIComponent(s)%20
JavaScriptnew URLSearchParams({ q: s }).toString()+
Pythonurllib.parse.quote(s, safe='')Without safe='', / is left as it is%20
Pythonurllib.parse.quote_plus(s)+
PHPrawurlencode($s)%20
PHPurlencode($s)+
JavaURLEncoder.encode(s, StandardCharsets.UTF_8)Form encoding, Java 10 and later+
C#Uri.EscapeDataString(s)%20
C#WebUtility.UrlEncode(s)+

Encoded twice?

If a URL shows %2520 where you expect a space, it has been encoded twice: the % of %20 was itself encoded as %25. It usually happens when an already encoded value is passed through an encoding function again. The tool above points it out; decode once more to get the original text.

Frequently asked questions

When should I encode a value and when a full URL?

Encode a value (encodeURIComponent) for anything you put inside a URL, such as a search term or parameter value: it escapes & = ? / and # too. Encode a full URL (encodeURI) only for a complete address that may contain spaces or non-English characters, which keeps its structure intact.

Why do spaces sometimes become + and sometimes %20?

Both mean a space. %20 is standard percent-encoding; + is used for spaces in HTML form submissions (application/x-www-form-urlencoded). The decoder here treats + as a space, which is right for query strings.

What does percent-encoding do?

It replaces characters that aren't allowed or have special meaning in URLs with a % followed by their UTF-8 bytes in hexadecimal. A space becomes %20, é becomes %C3%A9 and € becomes %E2%82%AC.

Is my URL sent anywhere?

No. Encoding, decoding and parsing all happen in your browser. That is important for URLs with tokens or personal data in them.