URL Encoder / Decoder
Show the math
What Your Result Means
- Output: The encoded or decoded string after transformation
- Input Characters: Total character count of the original text
- Output Characters: Total character count of the result (often longer when encoding)
- Percent-encoded characters: Unsafe characters like spaces and special symbols converted to %XX format
How This Calculator Works
URL encoding (percent-encoding) converts special characters into a safe format for use in URLs. The encoder replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20. The encodeURIComponent() function handles the encoding, while decodeURIComponent() reverses it. This is essential for query parameters, form data, and any user-provided text in URLs.
Quick Questions
What characters get encoded?
Special characters like spaces, punctuation, and non-ASCII characters. Safe characters like letters, digits, and a few symbols (- _ . ~) remain unchanged. All others become %XX codes.
What's the difference between encodeURI and encodeURIComponent?
encodeURIComponent is stricter and encodes more characters, suitable for query parameters and form data. encodeURI preserves URL structure characters like / and : so it's for full URLs.
When should I URL-encode?
When adding user input to URLs, especially in query parameters and form submissions. This prevents special characters from being misinterpreted as URL syntax.
Can I decode a full URL?
Use this tool for individual components. For full URLs, use decodeURI instead, which preserves URL syntax characters. This tool uses decodeURIComponent for segments.
What is percent-encoding?
The technical name for URL encoding. It's a standardized way to represent arbitrary bytes in URLs using only ASCII characters, defined in RFC 3986.
Sources
Method & review
Estimate only. Results reflect your inputs and standard formulas. Double-check important decisions independently.