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%20Not allowed in URLs
#%23Reserved for fragments
&%26Separates query params
+%2BMeans space in form data
=%3DSeparates key=value
?%3FStarts query string
/%2FPath separator
日本語%E6%97%A5%E6%9C%AC%E8%AA%9ENon-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

  1. Open the QuickTools URL Encoder
  2. Paste your URL or text string
  3. Click Encode
  4. 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

Why do URLs sometimes have %20 and sometimes +?
Both represent a space, but in different contexts. %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.
Is URL encoding the same as Base64?
No. URL encoding replaces special characters with %XX sequences. Base64 converts binary data to a text string using 64 printable characters. They solve different problems.
Do I need to encode the entire URL?
No. Only encode the parts that could contain special characters — typically the values in query string parameters. The protocol, domain, and path usually don't need encoding.
What is %0A?
%0A is a newline character (line feed, ASCII 10). %0D is a carriage return. Together %0D%0A represents a Windows-style line ending (CRLF).

Encode or decode your URL now

Free, instant, and runs entirely in your browser.

Open URL Encoder →