URL Encoder/Decoder

Encode or decode URLs for safe transmission.

What is URL Encoding?

URL encoding, also known as percent encoding, is the process of converting characters into a format that can be safely transmitted within a URL. URLs can only contain a limited set of characters from the ASCII character set. Any character outside this set -- including spaces, accented letters, and symbols with special URL meaning -- must be encoded.

The encoding replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20, an ampersand becomes %26, and a question mark becomes %3F. This mechanism is defined in RFC 3986.

Understanding URL encoding is essential for web developers who work with APIs, query strings, form submissions, and any system that constructs or parses URLs programmatically.

encodeURI vs encodeURIComponent

encodeURI (Encode URL)

Encodes a complete URI. Preserves characters that have special meaning in URLs: : / ? # [ ] @ ! $ & ' ( ) * + , ; =

https://example.com/path?q=hello world → https://example.com/path?q=hello%20world

Use this when you have a complete URL with spaces or non-ASCII characters in it.

encodeURIComponent (Encode Component)

Encodes a URI component (like a query parameter value). Encodes all special characters including those with URL significance.

hello=world → hello%3Dworld

Use this when encoding a single value that will be placed inside a URL parameter.

How to Use This Tool

  1. 1. Paste your URL or encoded string into the input field
  2. 2. Choose the operation: "Encode URL" for full URLs, "Encode Component" for parameter values, or "Decode" to reverse the encoding
  3. 3. Copy the result from the output field

URL Encoding in Different Languages

JavaScript
// Encode a full URL
encodeURI('https://example.com/search?q=hello world')
// "https://example.com/search?q=hello%20world"

// Encode a parameter value
encodeURIComponent('price=100¤cy=USD')
// "price%3D100%26currency%3DUSD"

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

# Encode a string
quote('hello world')       # "hello%20world"
quote('hello world', safe='')  # Encode everything

# Decode
unquote('hello%20world')   # "hello world"

# Build query string
urlencode({'q': 'hello world', 'page': '1'})
# "q=hello+world&page=1"
Go
import "net/url"

// Encode
encoded := url.QueryEscape("hello world")
// "hello+world"

// Decode
decoded, _ := url.QueryUnescape("hello+world")
// "hello world"

// Build URL with params
params := url.Values{}
params.Set("q", "hello world")
fullURL := "https://example.com/search?" + params.Encode()

Common Characters and Their Encodings

Character Encoded Description
(space)%20Space character
&%26Ampersand
=%3DEquals sign
?%3FQuestion mark
#%23Hash/fragment
/%2FForward slash

Frequently Asked Questions

What is URL encoding?
URL encoding (also called percent encoding) converts characters that are not allowed in URLs into a format that can be transmitted safely. Special characters are replaced with a percent sign (%) followed by their hexadecimal ASCII value. For example, a space becomes %20.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL and preserves special URL characters like :, /, ?, #, and =. encodeURIComponent encodes a single URL component (like a query parameter value) and encodes ALL special characters. Use encodeURI for full URLs and encodeURIComponent for parameter values.
Why do URLs need to be encoded?
URLs can only contain a limited set of ASCII characters. Characters like spaces, accented letters, and symbols like & or = have special meaning in URLs. Without encoding, browsers and servers would misinterpret these characters, causing broken links or incorrect data.
Should I use %20 or + for spaces?
Both are valid but used in different contexts. %20 is the standard percent encoding for spaces in URLs (per RFC 3986). The + sign is an older convention used specifically in HTML form data (application/x-www-form-urlencoded). Most modern APIs accept both.

Monitor your APIs

Ensure your endpoints handle encoded URLs correctly with UptimeSignal monitoring.

Start monitoring free →

25 monitors free. No credit card required.

Related Developer Tools