URL Codec
Safely encode or decode URI components.
About URL Codec & Percent-Encoding (RFC 3986)
Percent-Encoding (commonly referred to as URL encoding) is the universal mechanism defined by the Internet Engineering Task Force (IETF) in RFC 3986 to convert non-ASCII characters and reserved delimiter symbols within a Uniform Resource Identifier (URI) into a format that can be safely transmitted across the World Wide Web.
How URL Percent-Encoding Works
In standard URIs, characters are categorized into two classes:
- Unreserved Characters: Characters that have no special syntactic meaning and are never encoded:
A–Z,a–z,0–9, hyphen (-), underscore (_), period (.), and tilde (~). - Reserved Delimiters: Characters that define URI structure:
:,/,?,#,[,],@,!,$,&,',(,),*,+,,,;, and=.
When reserved characters or non-ASCII symbols (such as spaces, emojis, or international characters) appear as data values within query parameters or paths, they are converted to their UTF-8 byte representation, where each byte is prefixed with a percent sign (%) followed by two hexadecimal digits. For example, a space character becomes %20 (or + in form submissions), and an ampersand becomes %26.
encodeURI vs encodeURIComponent
| Function | Intended Scope | Encodes Delimiters (/ ? : & =)? |
|---|---|---|
encodeURI() |
Full URI / URL address | No (Preserves URL structure) |
encodeURIComponent() |
Single query parameter or value | Yes (Safely sanitizes all separators) |
Frequently Asked Questions (FAQ)
Why should I use URL encoding for query parameters?
If a parameter value contains characters like & or =, web servers will misinterpret them as key-value separators, corrupting the incoming request parameters.
What is the difference between %20 and + for spaces?
%20 is the strict RFC 3986 percent-encoding for spaces in URLs. The + character is used specifically in application/x-www-form-urlencoded form POST/GET submissions.
Does this tool handle multi-byte UTF-8 international characters?
Yes. Characters from Chinese, Japanese, Cyrillic, Arabic, and emojis are properly split into their multi-byte hexadecimal triplets (e.g. %E4%BD%A0%E5%A5%BD for 你好).