URL Encode
Try the free URL Encode tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
Input
Output
What is URL Percent-Encoding (RFC 3986) and Why is It Required?
URL encoding (officially termed Percent-Encoding, RFC 3986) is the standard mechanism for converting characters that are disallowed or syntactically reserved within a Uniform Resource Identifier (URI) into a safe '%XX' hexadecimal format.
The official URI specification defines a narrow subset of safe 'unreserved characters': alphanumeric ASCII characters (A-Z, a-z, 0-9) and four punctuation symbols (hyphen '-', underscore '_', period '.', and tilde '~').
Any character outside this set—such as whitespace, reserved delimiters (?, &, =, /, #), emojis, and non-ASCII multilingual scripts—must be percent-encoded to prevent URL parameter parsing errors or server-side truncation.
입출력 예시 (Examples)
| 입력 (Input) | 결과 (Output) | 설명 |
|---|---|---|
| hello world | hello%20world | Standard percent-encoding for space |
| user=john&role=admin | user%3Djohn%26role%3Dadmin | Encoding reserved delimiters in query values |
| https://example.com | https%3A%2F%2Fexample.com | Encoding a full URL as a parameter value |
| café | caf%C3%A9 | UTF-8 multi-byte accented character encoding |
JavaScript Encoding Functions Comparison
| Function | Target Scope | Preserved Delimiters (Unencoded) | Optimal Use Case |
|---|---|---|---|
| encodeURI() | Full URL / Link | ; , / ? : @ & = + $ # | Validating full hyperlinks and addresses |
| encodeURIComponent() | Individual parameters | - _ . ! ~ * ' ( ) | Query string keys, values, and redirect targets |
| escape() (Deprecated) | Non-ASCII chars | @ * _ + - . / | Obsolete; do not use in modern projects |
How to Use the Online URL Encoder
- Enter or paste the string you need to encode into the input box above.
- The tool immediately encodes characters into safe percent-encoded hex codes.
- Click the 'Copy' button to copy the encoded string to your clipboard.
- Use the 'URL Decode' tool from the navigation menu whenever you need to reverse the process.
Developer Best Practices & Implementation Tips
- Avoid Double Encoding: Encoding an already-encoded string turns '%' into '%25', resulting in malformed strings like '%2520'.
- Spaces: '%20' vs '+': Standard RFC 3986 URIs mandate '%20' for spaces in paths and query strings. The '+' symbol is strictly reserved for legacy HTML form payloads (application/x-www-form-urlencoded).
- Unicode Standard (UTF-8): All modern web percent-encoding must be derived from UTF-8 byte sequences.
프로그래밍 언어별 사용 예제 (Code Examples)
// Correctly encode query parameters
const param = encodeURIComponent('John Doe & Sons');
const url = `https://api.example.com/search?q=${param}`;
console.log(url); // https://api.example.com/search?q=John%20Doe%20%26%20Sonsimport urllib.parse
query = "John Doe & Sons"
encoded = urllib.parse.quote(query)
print(encoded) # John%20Doe%20%26%20SonsFAQ (자주 묻는 질문)
- Are URL encoding and percent-encoding the same thing?
- Yes. They are identical terms. 'Percent-encoding' refers to the specific representation using a percent sign (%) followed by two hexadecimal digits representing the byte value.
- Why does a space become '%20' in some places and '+' in others?
- According to standard RFC 3986 URI specifications, a space is always '%20'. The '+' representation is an older convention specific to application/x-www-form-urlencoded HTML form submissions.
- What happens if I don't URL encode query parameters?
- Characters like '&' or '=' will be misinterpreted as query parameter delimiters, causing truncated inputs, server parsing failures, or 400 Bad Request errors.
- Does this tool support emojis and non-English scripts?
- Yes. All UTF-8 multi-byte characters are accurately transformed into standard RFC-compliant percent sequences.
- Is any data sent to external servers?
- No. All operations run entirely within your local browser sandbox via JavaScript. No data is stored or logged.
Encoding — Tool Navigation
Base64 Encode
Try the free Base64 Encode tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
Base64 Decode
Try the free Base64 Decode tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
URL Decode
Try the free URL Decode tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
HTML Escape
Try the free HTML Escape tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
Unicode Converter
Try the free Unicode Converter tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
JWT Decoder
Try the free JWT Decoder tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.
Punycode Converter
Try the free Punycode Converter tool in the Encoding category provided by WebToolBox right in your browser. Process your tasks quickly and securely without any installation.