Browser based
URL Encoder/Decoder
Encode text for URLs or decode URL-encoded strings. Handle special characters safely for web addresses.
Bidirectional conversion
Encode text for URLs or decode URL-encoded strings with one click.
Handle special characters
Safely encode spaces, symbols, and international characters for URLs.
Privacy-first
All encoding happens in your browser. Your data never leaves your device.
In-depth guide
What is URL encoding
URL encoding converts special characters into a format safe for web addresses. URLs can only contain certain ASCII characters. Spaces, symbols, and non-ASCII characters must be encoded using percent-encoding. This ensures URLs work correctly across all browsers and servers.
Web browsers automatically encode URLs when you type them. However, when building URLs programmatically or passing data in query strings, manual encoding is necessary. Without proper encoding, URLs break or behave unexpectedly.
Query parameters require URL encoding. When passing data like search terms or user input in URLs, special characters must be encoded. A space becomes %20, an ampersand becomes %26. This prevents query parameters from interfering with URL structure.
International characters need encoding for URL compatibility. Non-ASCII characters like Chinese, Arabic, or emoji cannot appear directly in URLs. URL encoding converts these to percent-encoded UTF-8 sequences that work universally.
APIs expect URL-encoded data in certain contexts. Form submissions with application/x-www-form-urlencoded content type require URL encoding. OAuth signatures and other authentication mechanisms also use URL encoding.
How URL encoding works
URL encoding replaces unsafe characters with percent signs followed by hexadecimal values. Each character converts to its UTF-8 byte representation. For example, a space becomes %20, an exclamation mark becomes %21.
Reserved characters have special meaning in URLs. Characters like ?, &, =, and # structure URLs. When these characters appear as data rather than structure, they must be encoded. A question mark in data becomes %3F.
Unreserved characters do not need encoding. Letters A-Z and a-z, digits 0-9, and characters like hyphen, underscore, period, and tilde are safe. These characters can appear in URLs without encoding.
Encoding happens character by character. Each unsafe character converts independently. The string "hello world" becomes "hello%20world". Multiple spaces become multiple %20 sequences.
Decoding reverses the process. Each %XX sequence converts back to its original character. Decoders recognize percent signs followed by two hexadecimal digits as encoded characters. Invalid sequences may cause decoding errors.
Common URL encoding scenarios
Search functionality requires URL encoding. Search terms often contain spaces and special characters. Using a URL Encoder ensures search queries work correctly in URLs. This prevents broken searches and improves user experience.
API integration needs proper URL encoding. When building API requests with query parameters, encoding prevents errors. User-generated content in URLs must be encoded to avoid security issues and parsing problems.
Social media sharing uses encoded URLs. When sharing links with titles or descriptions in query parameters, encoding ensures the full URL works. Unencoded ampersands or equals signs break social media previews.
Analytics tracking parameters require encoding. UTM parameters and custom tracking data often contain spaces and special characters. Proper encoding ensures analytics tools receive correct data.
Email links with parameters need encoding. Mailto links with subject lines or body text must encode special characters. This ensures email clients correctly populate message fields.
Best practices for URL encoding
Always encode user input before adding to URLs. Never trust user data to be URL-safe. Even seemingly safe input may contain characters that break URLs. Consistent encoding prevents security vulnerabilities.
Encode only the necessary parts of URLs. Do not encode the entire URL including protocol and domain. Only encode query parameter values and path segments that contain user data.
Use proper encoding functions. Different contexts require different encoding. encodeURIComponent() encodes everything except unreserved characters. encodeURI() preserves URL structure characters.
Test URLs with special characters. Verify encoded URLs work correctly before deploying. Test with spaces, international characters, and symbols. Ensure decoding produces the original input.
Document encoding requirements in APIs. API documentation should specify which parameters need URL encoding. Clear documentation prevents integration errors and reduces support requests.
Frequently asked questions
What is the difference between URL encoding and Base64?
URL encoding makes text safe for URLs by replacing special characters. Base64 converts binary data to text. They serve different purposes.
Why do spaces become %20?
Spaces are not allowed in URLs. %20 is the hexadecimal representation of a space character in URL encoding.
Can I encode entire URLs?
You should only encode query parameter values and path segments, not the entire URL including protocol and domain.
Is URL encoding secure?
URL encoding is not encryption. It makes text URL-safe but does not protect sensitive data. Use HTTPS for security.