URL Encoder
Encode and decode URLs using encodeURI and encodeURIComponent. Shows both results side by side with real-time conversion as you type.
Key features
- Encode text to URL-safe format with encodeURIComponent
- Decode URL-encoded strings back to readable text
- Compare encodeURI vs encodeURIComponent results
- Real-time conversion as you type
Guide
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a safe format using percent signs and hexadecimal values. Every character that is not an unreserved character (letter, digit, or one of - . _ ~) is replaced with %HH where HH is the character's hexadecimal byte value. A space becomes %20, a forward slash becomes %2F, an ampersand becomes %26, and a plus sign becomes %2B. This tool encodes and decodes URLs and URI components in your browser. ## Why URL Encoding Exists URLs can only contain a limited set of characters defined by RFC 3986. The unreserved characters are A-Z, a-z, 0-9, hyphen (-), period (.), underscore (_), and tilde (~). These characters can appear anywhere in a URL without special meaning. Reserved characters have special meaning in URL structure: / separates path segments, ? starts the query string, & separates query parameters, = assigns values to parameter names, # marks the fragment identifier, : separates the scheme, @ separates userinfo from host, and [ ] delimit IPv6 addresses. These characters can only be used for their reserved purpose unless percent-encoded. Any other character, including spaces, non-ASCII characters (accented letters, CJK characters, emoji), and special symbols (< > { } | \ ^ ` and many others) must be percent-encoded to be included in a URL. Without encoding, ambiguity arises. Consider the URL https://example.com/search?q=rock&roll. Is "roll" a second parameter or part of the search query? The URL parser sees two parameters: q=rock and roll (with no value). If the intended query is literally "rock&roll\
Frequently asked questions
What is URL encoding?
URL encoding replaces unsafe characters with percent-encoded equivalents (e.g., space → %20) so they can be safely used in URLs.
What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves URL structure characters (://?#), while encodeURIComponent encodes everything except letters, digits, and -_.~
