URL Encode Online

Free online URL encoder & decoder. Instantly encode or decode URL components.

Paste text in the input box and click URL Encode to convert special characters to percent-encoded form. Click URL Decode to reverse it. This tool uses JavaScript's encodeURIComponent(), which encodes all characters except A–Z a–z 0–9 - _ . ! ~ * ' ( ).

What is URL encoding (percent encoding)?

URL encoding, formally called percent encoding (RFC 3986), replaces unsafe or reserved characters in a URL with a % sign followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, / becomes %2F, and & becomes %26.

This ensures that a URL is a valid ASCII string that can be safely transmitted over HTTP and interpreted correctly by any web server or browser.

encodeURIComponent vs encodeURI

encodeURIComponent()
Encodes all characters except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use this for encoding individual query parameter values. This is what this tool uses.
encodeURI()
Encodes a complete URL but leaves reserved URL characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) unencoded, because they have structural meaning in a URL.

Common percent-encoded characters

Quick reference
Space → %20    ! → %21    " → %22    # → %23
$  → %24       % → %25    & → %26    ' → %27
(  → %28       ) → %29    * → %2A    + → %2B
,  → %2C       / → %2F    : → %3A    ; → %3B
=  → %3D       ? → %3F    @ → %40    [ → %5B
]  → %5D       { → %7B    | → %7C    } → %7D

Code examples

JavaScript
// Encode a query parameter value
const q = encodeURIComponent('hello world & more');
// "hello%20world%20%26%20more"

// Build a full URL safely
const url = 'https://example.com/search?q=' + encodeURIComponent(query);

// Decode
const decoded = decodeURIComponent('hello%20world');  // "hello world"
Python
from urllib.parse import quote, urlencode

# Encode a single value
encoded = quote('hello world & more')  # 'hello%20world%20%26%20more'

# Encode a dict of query parameters
params = urlencode({'q': 'hello world', 'lang': 'en'})
# 'q=hello+world&lang=en'  (note: urlencode uses + for spaces)

Frequently asked questions

What is the difference between %20 and + for spaces?
%20 is the standard percent-encoding for a space and is valid everywhere in a URL. + represents a space only in the application/x-www-form-urlencoded format used in HTML form submissions. When in doubt, use %20 — it is unambiguous everywhere.
Should I encode an entire URL or just the query parameter values?
Encode only the values of query parameters (using encodeURIComponent), not the entire URL. Encoding the entire URL would also encode the structural ://, /, and ? characters, breaking the URL.
Which characters are safe and never need encoding?
RFC 3986 unreserved characters are always safe: letters A–Z a–z, digits 0–9, and the four special characters - _ . ~.
What is double encoding?
Double encoding occurs when an already-encoded string (e.g. hello%20world) is encoded again, turning %20 into %2520. The server then receives a literal %20 instead of a space. Always check whether input is already encoded before encoding it.

Related tools