URL Encoder & Decoder - Percent-Encode URLs Online
Encode or Decode a URL Component
Paste text in Encode mode and every character that is not safe inside
a URL component becomes a % followed by two hex digits.
A space becomes %20, & becomes
%26, and é becomes %C3%A9
(its two UTF-8 bytes). Decode mode reverses it. Results update as you
type and nothing is sent to a server.
Encode one piece at a time: a query value, a path segment, or a whole
URL that you are passing as a parameter to another URL. For example,
to put https://shop.example.com/cart?id=7&ref=mail
into a redirect= parameter, encode it to
https%3A%2F%2Fshop.example.com%2Fcart%3Fid%3D7%26ref%3Dmail.
Without that, the &ref=mail part would be read as a
separate parameter of the outer URL.
When decoding a query string copied from an HTML form submission, tick
"Treat + as space" so that hello+world becomes
hello world. Leave it off for paths and for values
produced by encodeURIComponent, where + is a
literal plus.
URL Percent-Encoding Table
Each encoded character is a % followed by the hex value of
its byte. Non-ASCII characters are first converted to UTF-8, so one
character can become two to four %XX groups. The table shows
whether each character must be encoded inside a path segment
(/files/here/) and inside a query value
(?q=here), and what JavaScript's two built-in
functions do with it.
| Character | Encoded | In path | In query value | encodeURI | encodeURIComponent |
|---|---|---|---|---|---|
| space | %20 | Yes | Yes (or +) | Yes | Yes |
| ! | %21 | No | No | No | No |
| " | %22 | Yes | Yes | Yes | Yes |
| # | %23 | Yes | Yes | No | Yes |
| $ | %24 | No | Optional | No | Yes |
| % | %25 | Yes | Yes | Yes | Yes |
| & | %26 | No | Yes | No | Yes |
| ' | %27 | No | No | No | No |
| ( ) | %28 %29 | No | No | No | No |
| * | %2A | No | No | No | No |
| + | %2B | No | Yes | No | Yes |
| , | %2C | No | Optional | No | Yes |
| / | %2F | Yes, inside a segment | No | No | Yes |
| : | %3A | No | No | No | Yes |
| ; | %3B | Optional | Yes | No | Yes |
| < > | %3C %3E | Yes | Yes | Yes | Yes |
| = | %3D | No | Yes | No | Yes |
| ? | %3F | Yes | No | No | Yes |
| @ | %40 | No | No | No | Yes |
| [ ] | %5B %5D | Yes | Yes | Yes | Yes |
| \ | %5C | Yes | Yes | Yes | Yes |
| ^ ` | %5E %60 | Yes | Yes | Yes | Yes |
| { | } | %7B %7C %7D | Yes | Yes | Yes | Yes |
| ~ - _ . | (never encoded) | No | No | No | No |
| é | %C3%A9 | Yes | Yes | Yes | Yes |
| € | %E2%82%AC | Yes | Yes | Yes | Yes |
"Optional" means the character is legal there but some servers or
frameworks treat it specially, so encoding it is the safe choice. The
unreserved characters A-Z a-z 0-9 - _ . ~ never need
encoding anywhere.
encodeURI vs encodeURIComponent
encodeURI is for a complete URL. It leaves the structural
characters : / ? # & = + $ , ; @ alone so the URL still
works, which means it will not protect a value that contains them.
encodeURIComponent is for one piece, such as a single query
value or path segment, and encodes all of those characters. For example,
encodeURIComponent("a&b=c") gives
a%26b%3Dc, while encodeURI returns it unchanged
and breaks the query string. This tool uses
encodeURIComponent. To split a full URL into parts and edit
its parameters, use the URL parser.
Common Problems
- Double encoding.
%2520in a URL means a%20was encoded a second time (%became%25). Decode once to see the extra layer, and find the step in your code that encodes an already encoded value. - "URI malformed" errors. Decoding fails when a
%is not followed by two hex digits, as in100%or50%off, or when the bytes are not valid UTF-8. Encode a literal percent sign as%25. - Plus signs turning into spaces. A phone number like
+6421...sent unencoded in a query string arrives as a space on servers that use form decoding. Encode it as%2B. - Characters left alone.
encodeURIComponent, which this tool uses, does not encode! ' ( ) *. They are legal in URLs, but some OAuth 1.0 and AWS signature schemes require them encoded. Replace them by hand with%21 %27 %28 %29 %2Aif your API asks for strict RFC 3986 encoding.
Related Tools
JWT Decoder
Decode JSON Web Tokens and inspect header, payload and signature.
Base64 Encode / Decode
Encode text to Base64 or decode Base64 strings back to plain text.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
MD5 Hash Generator
Generate MD5 hashes from text for checksums and legacy systems.