URL Encoder
Encode special characters for safe URL transmission
Input Information
Result
URL Encoder converts special characters in URLs and text into percent-encoded format (%XX) that can be safely transmitted over the internet.
Two encoding modes are available:
- encodeURIComponent: Encodes all special characters. Use for individual parameter values.
- encodeURI: Preserves URI structure characters (/, :, ?, etc.). Use for complete URLs.
Term Glossary
- URL Encoding (Percent Encoding)
- The process of turning spaces and special characters that are invalid in URLs into % followed by a two-digit hex code (e.g., %20) so they can be transmitted safely.
- encodeURIComponent / encodeURI
- Built-in JavaScript encoding functions. encodeURIComponent encodes all special characters, while encodeURI preserves URL structure characters (/, :, ?, etc.).
- 1
Type or paste text
Enter the URL or text you want to encode into the input.
- 2
Click encode
Clicking the button converts spaces and special characters into %XX format.
- 3
Review the %XX output
Check that special characters and Korean text were encoded correctly.
- 4
Copy the result
Copy the encoded string for use in URLs or API requests.
Example 1 — Sentence with spaces
"hello world" → hello%20world
The two spaces are each converted to %20. This is how the search phrase 'hello world' is placed into a URL.
Example 2 — With special characters
"a&b=c" → a%26b%3Dc
Inside a parameter value, & and = would break the query structure, so they become %26 and %3D. This keeps the whole value delivered as a single parameter.
Example 3 — Korean text
"한글" → %ED%95%9C%EA%B8%80
Under UTF-8, each Korean syllable is 3 bytes, so '한글' becomes 6 bytes rendered as %ED%95%9C%EA%B8%80.
Encoding Examples:
Space → %20
! → %21
# → %23
& → %26
+ → %2B
Each special character is replaced by % followed by its two-digit hexadecimal ASCII code.
Tips:
- Use
encodeURIComponentfor query parameter values to avoid breaking the URL structure. - Use
encodeURIwhen you want to encode a complete URL but keep its structure intact. - Letters, numbers, and - _ . ! ~ * ' are not encoded by encodeURIComponent.
- Spaces are encoded as %20 (not +) when using encodeURIComponent.
QWhich characters get encoded?
Letters (A-Z, a-z), digits (0-9), and - _ . ! ~ * ' are not encoded. Everything else — spaces, special characters (&, #, ?, =, +, etc.), and non-ASCII text like Korean — is encoded as %XX.
QWhy do spaces become %20?
Because URLs cannot contain raw spaces. The ASCII hex code for a space is 0x20, so it becomes %20. In HTML form encoding (application/x-www-form-urlencoded) a space becomes +, but in URL encoding it becomes %20.
QWhat is the difference between UTF-8 and other charsets?
Non-ASCII text encodes to different bytes depending on the charset. Under UTF-8, '한글' becomes %ED%95%9C%EA%B8%80, but a different charset yields different values. Use a consistent charset (default UTF-8) so decoding recovers the original text.
QWhen is URL encoding needed?
Whenever a URL contains spaces, Korean text, or special characters. Query parameter values, search terms, file names, shared links, and API calls all need encoding so invalid characters don't break the URL structure.
QHow do I handle already-encoded strings?
Re-encoding a string that already contains %XX turns each % into %25 (double encoding). Use already-encoded strings as-is, or decode then re-encode if needed. Accidental double encoding can cause the server to misread the value.