DevTools

URL Encoder & Decoder Online

Encode or decode URLs to ensure they are properly formatted for web transmission.

Percent-Encoding Reference

Reserved characters have a structural meaning inside a URL and must be percent-encoded whenever they appear as data. Unreserved characters are always safe. Everything outside ASCII is encoded byte by byte as UTF-8, so a Chinese character costs three %XX escapes and an emoji four. The JavaScript column shows what encodeURIComponent() emits — it leaves ! ' ( ) * alone — while the RFC 3986 column is the strict percent-encoded form.

CharacterNameClassencodeURIComponentRFC 3986
␣spaceunsafe / delimiter%20%20
"double quoteunsafe / delimiter%22%22
%percent signunsafe / delimiter%25%25
<less-thanunsafe / delimiter%3C%3C
>greater-thanunsafe / delimiter%3E%3E
\backslashunsafe / delimiter%5C%5C
^caretunsafe / delimiter%5E%5E
`backtickunsafe / delimiter%60%60
{left braceunsafe / delimiter%7B%7B
|vertical barunsafe / delimiter%7C%7C
}right braceunsafe / delimiter%7D%7D
!exclamation markreserved!%21
#number sign (fragment)reserved%23%23
$dollar signreserved%24%24
&ampersand (parameter separator)reserved%26%26
'apostrophereserved'%27
(left parenthesisreserved(%28
)right parenthesisreserved)%29
*asteriskreserved*%2A
+plus (space in form encoding)reserved%2B%2B
,commareserved%2C%2C
/slash (path separator)reserved%2F%2F
:colonreserved%3A%3A
;semicolonreserved%3B%3B
=equals (key/value separator)reserved%3D%3D
?question mark (query start)reserved%3F%3F
@at signreserved%40%40
[left bracketreserved%5B%5B
]right bracketreserved%5D%5D
-hyphenunreserved (never encoded)-%2D
_underscoreunreserved (never encoded)_%5F
.periodunreserved (never encoded).%2E
~tildeunreserved (never encoded)~%7E
éLatin e with acuteUTF-8 multi-byte%C3%A9%C3%A9
üLatin u with diaeresisUTF-8 multi-byte%C3%BC%C3%BC
你Chinese characterUTF-8 multi-byte%E4%BD%A0%E4%BD%A0
日Japanese kanjiUTF-8 multi-byte%E6%97%A5%E6%97%A5
😀emoji (4 bytes)UTF-8 multi-byte%F0%9F%98%80%F0%9F%98%80

What Is URL Encoding?

URL encoding — also called percent encoding — is a mechanism defined in RFC 3986 for representing arbitrary data within a Uniform Resource Identifier. When a URL contains characters that are either reserved (such as &, =, ?, and #) or unsafe for transmission (such as spaces, non-ASCII characters, and control bytes), those characters must be replaced with a percent sign followed by their two-digit hexadecimal code point. For example, a space becomes %20, an ampersand becomes %26, and a Chinese character like 你 becomes its UTF-8 bytes encoded as %E4%BD%A0.

The distinction between reserved and unreserved characters is central to percent encoding. Unreserved characters — A through Z, a through z, 0 through 9, hyphen, underscore, period, and tilde — are safe to use as-is everywhere in a URL. Everything else must be encoded when it appears as data rather than as a structural delimiter. This rule matters most for query parameter values: a value containing an unescaped & would be misread as the start of a new parameter.

JavaScript provides two built-in functions for this purpose: encodeURIComponent encodes everything except unreserved characters and is the correct choice for individual query parameter keys and values; encodeURI preserves the structural characters (/, :, ?, #, &) and is meant for encoding a full URL that is already well-formed. The url encoder and url decoder on this page apply encodeURIComponent-style percent encoding by default. For binary payloads carried in a query string, reach for the Base64 Converter instead, and use the JSON Formatter when a parameter holds an encoded JSON object.

▶

How to URL Encode or Decode a String Online

  1. 1
    Paste your text. Type or paste text in the left panel to encode it, or a percent-encoded string in the right panel to decode it. The direction follows the panel you edit.
  2. 2
    Read the result. The opposite panel updates instantly, with full UTF-8 support for CJK text and emoji.
  3. 3
    Copy the result. Click Copy above the encoded panel to put the result on your clipboard.
▶

Encoding Query Parameters and Double Encoding

Paste the text you want to encode into the left panel. Every character outside the unreserved set is immediately replaced with its percent-encoded equivalent in the right panel. To reverse the process, paste a percent-encoded string into the right panel — the tool reconstructs the original bytes and shows them as UTF-8 text on the left. The reference table above lists the encoding of every reserved character.

For query parameters, always encode the value alone, not the entire URL. Encoding https://example.com/search?q=hello world as a whole will corrupt the structural slashes and colon; instead encode only hello world to get hello%20world and then assemble the URL. If your string has already been encoded once and you see sequences like %2520 (a double-encoded percent sign), run decode twice to recover the original text.

▶

Code Examples

▶JavaScript / TypeScript
// encodeURIComponent — encode a single query parameter value
const query = "hello world & more";
console.log(encodeURIComponent(query));
// "hello%20world%20%26%20more"

// encodeURI — encode a complete URL, preserving structural characters
const url = "https://example.com/search?q=hello world";
console.log(encodeURI(url));
// "https://example.com/search?q=hello%20world"

// Decode
console.log(decodeURIComponent("hello%20world%20%26%20more"));
// "hello world & more"
▶Python
from urllib.parse import quote, unquote, urlencode

# Encode a single value (safe='' encodes everything including /)
value = "hello world & more"
print(quote(value, safe=""))
# "hello%20world%20%26%20more"

# Encode a dict of query parameters
params = {"q": "hello world", "lang": "en"}
print(urlencode(params))
# "q=hello+world&lang=en"

# Decode
print(unquote("hello%20world%20%26%20more"))
# "hello world & more"
▶Go
package main

import (
    "fmt"
    "net/url"
)

func main() {
    // Encode a query parameter value
    value := "hello world & more"
    encoded := url.QueryEscape(value)
    fmt.Println(encoded) // "hello+world+%26+more"

    // url.PathEscape preserves slashes, suitable for path segments
    path := url.PathEscape("path/to my file")
    fmt.Println(path) // "path%2Fto%20my%20file"

    // Decode
    decoded, _ := url.QueryUnescape(encoded)
    fmt.Println(decoded) // "hello world & more"
}
▶Bash
# Encode with curl (writes encoded form to stdout)
curl -Gso /dev/null -w "%{url_effective}"   --data-urlencode "q=hello world & more"   "https://example.com" | cut -c2-
# ?q=hello%20world%20%26%20more

# Encode using printf + xxd (portable, no curl required)
printf '%s' "hello world" | xxd -plain | tr -d '
' |   sed 's/\(..\)/%\1/g'
# %68%65%6c%6c%6f%20%77%6f%72%6c%64

# Decode with Python one-liner (available on most systems)
python3 -c "import sys, urllib.parse; print(urllib.parse.unquote(sys.argv[1]))"   "hello%20world%20%26%20more"
# hello world & more
▶

Frequently Asked Questions

▶

What is URL encoding (percent encoding)?

URL encoding replaces unsafe characters in a URL with a percent sign (%) followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26.

▶

When should I URL encode a string?

You should URL encode any string that will be used as a query parameter, path segment, or fragment — especially if it contains spaces, special characters (&, =, ?, #), or non-ASCII characters like Chinese or emoji.

▶

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a full URL but preserves characters like :, /, ?, and #. encodeURIComponent encodes everything except A-Z, a-z, 0-9, and a few symbols, making it suitable for encoding individual query parameter values.

▶

Can this tool decode double-encoded URLs?

Yes. Paste the string into the encoded panel to decode it once; if the result still contains sequences like %20 (a %2520 was a double-encoded space), paste that result back into the encoded panel to decode it again.

Related Developer Tools