Have you ever seen a URL like https://example.com/search?q=hello%20world and wondered what %20 means? That's URL encoding (also called percent encoding). This guide explains what it is, why it matters, and how to encode and decode URLs instantly online.
⚡ Free URL Encoder / Decoder
Encode or decode any URL or query string instantly. Free, no signup.
Open URL Encoder →What Is URL Encoding?
URLs can only contain a limited set of ASCII characters. Characters outside this set — including spaces, Unicode letters, and special symbols — must be encoded so they can be safely transmitted over the internet.
URL encoding replaces unsafe characters with a % followed by two hexadecimal digits representing the character's byte value. This is why it's also called percent encoding.
Example: a space character (byte value 32, or 0x20 in hex) becomes %20.
Which Characters Get Encoded?
URL-safe characters that do not need encoding (RFC 3986 unreserved characters):
A–Z a–z 0–9 - _ . ~
Everything else is encoded, including:
| Character | Encoded | Reason |
|---|---|---|
| Space | %20 | Not allowed in URLs |
| # | %23 | Reserved for fragments |
| & | %26 | Separates query params |
| + | %2B | Means space in form data |
| = | %3D | Separates key=value |
| ? | %3F | Starts query string |
| / | %2F | Path separator |
| 日本語 | %E6%97%A5%E6%9C%AC%E8%AA%9E | Non-ASCII |
encodeURI vs. encodeURIComponent
JavaScript has two built-in URL encoding functions with an important difference:
encodeURI()
Encodes a complete URL. It does not encode characters that are valid parts of a URL structure (: / ? # [ ] @ ! $ & ' ( ) * + , ; =).
encodeURI("https://example.com/search?q=hello world")
// → "https://example.com/search?q=hello%20world"
encodeURIComponent()
Encodes a component of a URL (like a query parameter value). It encodes everything except unreserved characters.
encodeURIComponent("price=100¤cy=USD")
// → "price%3D100%26currency%3DUSD"
Rule of thumb: Use encodeURIComponent() when encoding individual parameter values. Use encodeURI() for a full URL.
Common URL Encoding Issues
Double-encoding
If you encode an already-encoded URL, you get double-encoding: %20 becomes %2520. Always decode first before re-encoding.
Space as + vs %20
In HTML form submissions (application/x-www-form-urlencoded), spaces are encoded as +. In general URL encoding (RFC 3986), spaces are %20. Make sure you're using the right variant for your context.
Non-ASCII characters in URLs
Characters like Japanese (日本語) or emoji (🚀) must be UTF-8 encoded, then percent-encoded. Modern browsers do this automatically in the address bar, but you may need to handle it manually in code.
How to URL Encode Online
- Open the QuickTools URL Encoder
- Paste your URL or text string
- Click Encode
- Copy the encoded result
URL Encoding in Different Languages
# Python
from urllib.parse import quote, unquote
quote("hello world") # → 'hello%20world'
unquote("hello%20world") # → 'hello world'
# JavaScript
encodeURIComponent("hello world") # → 'hello%20world'
decodeURIComponent("hello%20world") # → 'hello world'
# PHP
urlencode("hello world") # → 'hello+world'
urldecode("hello+world") # → 'hello world'
rawurlencode("hello world") # → 'hello%20world'
URL Parser
Need to break a full URL into its components (protocol, host, path, query params, fragment)? Use the URL Parser to analyze any URL.
Frequently Asked Questions
%20 is standard percent encoding (RFC 3986). + is used in application/x-www-form-urlencoded (HTML forms). Most modern web apps treat them the same, but it's best to use %20 in general URLs.%0A is a newline character (line feed, ASCII 10). %0D is a carriage return. Together %0D%0A represents a Windows-style line ending (CRLF).