Skip to content

URL Encoder

Encode text for URLs online with percent-encoding. Free URL encoder for safely escaping special characters in query strings and paths.

URL Decode

About URL Encoding

URL encoding (also known as percent-encoding) converts characters into a format that can be safely transmitted over the internet. Special characters are replaced with a "%" followed by their hexadecimal value.

Common Encodings:

Space: %20
&: %26
=: %3D
?: %3F

How to Use URL Encoder

1

Enter your text

Type or paste the text you want to URL-encode (typically a query parameter value, URL path segment, or fragment). Encoding happens automatically as you type.

2

View encoded output

Reserved and unsafe characters are percent-encoded (e.g., space → %20, & → %26, # → %23). Unicode characters are encoded as UTF-8 byte sequences.

3

Copy and use in URL

Click Copy to put the encoded value on your clipboard. Concatenate it with your URL structure: example.com/path?query=encodedValue.

4

Round-trip with decoder

Use the URL Decoder to reverse the encoding when needed — they're perfectly compatible, encoding then decoding produces your original input.

When to Use URL Encoder

Building URLs with user-input parameters

When constructing URLs that include user-typed search queries, names, emails, or any free-form input, encode each value before insertion. This prevents bugs from special characters (spaces, ampersands, plus signs) breaking the URL structure or being misinterpreted by servers. Always: `?q=${encodeURIComponent(query)}` not `?q=${query}`.

API requests with query parameters

REST APIs receiving filter values, sort parameters, or search terms from your client-side code need URL-encoded values. Without encoding, characters like '&' (in 'John & Jane') would be interpreted as parameter separators, causing parsing errors or security issues. Encode each value before assembling the URL.

OAuth/OpenID redirect URLs

OAuth flows pass redirect URLs as parameters (`redirect_uri=...`). The redirect URL must be URL-encoded so its own query parameters and special characters don't conflict with the outer URL's structure. Same applies to state parameters carrying nested data.

Sharing URLs via SMS, email, social media

When generating shareable URLs containing dynamic content (search results, user-specific links), URL-encoding ensures the link works when copied, pasted, or processed by various platforms. Each platform has different parsing rules, but properly encoded URLs work universally.

URL Encoder Examples

Encoding spaces and special chars

Input
Hello, World! How are you?
Output
Hello%2C%20World!%20How%20are%20you%3F

Spaces become %20, comma becomes %2C, question mark becomes %3F. Note '!' is preserved (it's allowed in URLs), but encoders may encode it for extra safety. The output is now safe to embed as a query parameter value.

Encoding for query string

Input
name=John&role=admin
Output
name%3DJohn%26role%3Dadmin

When a string containing '=' and '&' is itself a parameter value, encode them so they're not interpreted as parameter separators. Example: `?data=name%3DJohn%26role%3Dadmin` correctly transmits the literal string 'name=John&role=admin' as the value of the 'data' parameter.

Encoding Unicode

Input
Café 中文
Output
Caf%C3%A9%20%E4%B8%AD%E6%96%87

Unicode characters are first encoded as UTF-8 bytes (é = 0xC3 0xA9, 中 = 0xE4 0xB8 0xAD, 文 = 0xE6 0x96 0x87), then each byte is percent-encoded. This works in any URL context worldwide; older systems that don't support Unicode will see the raw bytes but won't break.

Tips & Best Practices for URL Encoder

  • 1.Use encodeURIComponent (this tool's behavior) for parameter values; use encodeURI only for whole URLs where you want to preserve URL structure characters. When in doubt, use encodeURIComponent — it's safer.
  • 2.Don't double-encode. If your data is already URL-encoded, encoding again produces %25XX instead of %XX (because % itself becomes %25). This causes confusing bugs. Track encoding state through your code carefully.
  • 3.Build URLs with URLSearchParams or your framework's query helpers (axios params, fetch URLSearchParams). They handle encoding automatically and consistently. Manual string concatenation is error-prone.
  • 4.Encode form data values, not the entire form. application/x-www-form-urlencoded content is `key1=value1&key2=value2` where each key and value is encoded separately. Build the form data with proper concatenation.
  • 5.For very long encoded URLs (>2000 chars), consider switching to POST with a body — most servers support GET URLs only up to 2048-8192 chars, and proxies may truncate longer URLs. POST has no practical size limit and is safer for sensitive query data.
  • 6.When debugging encoded URLs, paste them into a URL decoder to see what's actually being sent. Browser DevTools also auto-decode displayed URLs, but server logs and API tools often show the raw encoded form.

Frequently Asked Questions

URL encoding (also called percent-encoding) replaces unsafe characters in URLs with a '%' followed by two hexadecimal digits representing the character's ASCII value. For example, a space becomes %20, '&' becomes %26, '#' becomes %23. This ensures URLs work correctly in HTTP requests, browsers, and across different systems regardless of input characters.