URL Encoder
Encode text for URLs online with percent-encoding. Free URL encoder for safely escaping special characters in query strings and paths.
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:
%20%26%3D%3FHow to Use URL Encoder
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.
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.
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.
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
Hello, World! How are you?Hello%2C%20World!%20How%20are%20you%3FSpaces 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
name=John&role=adminname%3DJohn%26role%3DadminWhen 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
Café 中文Caf%C3%A9%20%E4%B8%AD%E6%96%87Unicode 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
Related Tools
URL Decoder
Decode URL-encoded text online by converting percent-encoded characters back to readable text. Free URL decoder for web developers.
HTML Entity Encoder
Encode HTML entities online to safely display special characters in web pages. Free HTML entity encoder for angle brackets and quotes.
HTML Entity Decoder
Decode HTML entities back to readable characters online. Free HTML entity decoder for converting ampersand codes to plain text.
Base64 Encoder
Encode text to Base64 format online instantly. Free Base64 encoder for converting strings, data URIs, and binary content safely.
Text to Binary Converter
Convert text to binary code online with space-separated byte output. Free text to binary encoder for learning and data conversion.
ROT13 Encoder/Decoder
Encode and decode text with the ROT13 substitution cipher online. Free ROT13 tool for simple text obfuscation and puzzle solving.