Online URL Encoder
Encode URLs and query parameters using standard percent-encoding to ensure safe HTTP transmissions.
Uniform Resource Identifiers and Percent-Encoding (RFC 3986)
Uniform Resource Identifiers (URIs) and URLs are governed by international standards defined by Tim Berners-Lee and the IETF in RFC 3986. Because URLs are transmitted across varied internet protocols, the specification limits valid URL characters to a narrow subset of US-ASCII characters.
When query parameters contain spaces, ampersands, slashes, or non-ASCII characters, these values must be translated into percent-encoded representations (also known as URL encoding) to prevent misinterpretation by web servers and routing proxies.
Reserved vs. Unreserved Characters in URLs
RFC 3986 categorizes characters into two distinct groups:
- Unreserved Characters: Characters that can be used freely without encoding: uppercase and lowercase letters (
A-Z,a-z), decimal digits (0-9), hyphens (-), underscores (_), periods (.), and tildes (~). - Reserved Characters: Characters that carry special structural meaning within a URL: delimiters like
:,/,?,#,[,],@,!,$,&,',(,),*,+,,,;, and=. When these characters appear as data values within query strings, they must be percent-encoded.
encodeURI vs encodeURIComponent: Key Distinctions
Understanding which JavaScript encoding method to use is essential for web developers:
| Method | Intended Target | Characters Preserved Without Encoding |
|---|---|---|
encodeURI() |
Full, complete URLs | Preserves structural delimiters: :, /, ?, &, =, # |
encodeURIComponent() |
Individual query parameter values | Encodes all structural delimiters, including /, ?, &, and = |
Frequently Asked Questions
Why is a space encoded as '%20' instead of '+'?
RFC 3986 defines '%20' as the standard percent-encoded representation of a space. While the '+' character is commonly used in application/x-www-form-urlencoded forms, '%20' is universally valid across all URL components.
When should I use encodeURIComponent instead of encodeURI?
Use encodeURIComponent when encoding individual query parameter values. Use encodeURI only when encoding a complete URL where structural characters (like :// and ?) must remain unencoded.
Does URL encoding support Unicode and emojis?
Yes. Unicode characters are first converted to their UTF-8 byte sequences, then each byte is percent-encoded into two hexadecimal digits.
Will URL encoding an already encoded URL cause problems?
Yes. Encoding an already encoded string creates double-encoding (e.g., %20 becomes %2520), which can cause 404 errors or corrupted parameter values.
Is my text sent to a remote server during encoding?
No. All encoding runs locally inside your browser's JavaScript engine. Your URLs and parameters remain completely private.
Can I encode passwords or sensitive tokens with this tool?
Yes. Because processing occurs entirely client-side without network requests, your sensitive tokens and credentials are safe to encode.