URL Encoder/Decoder

Text & Data Tools
URL Encoder / Decoder
Encoded Result
Copy this code to embed: <iframe src="/calcs/calculators/text-data/url-encoder-decoder?embed=1.html" width="100%" height="500" frameborder="0" style="border:1px solid #e2e8f0;border-radius:8px;"></iframe>
Advertisement
How to Use This Calculator

How to Use the URL Encoder/Decoder

The URL Encoder/Decoder converts text to URL-safe format (percent-encoding) and back. URLs can only contain certain characters, so spaces, special characters, and non-ASCII text must be encoded for proper transmission in web addresses, API calls, and form submissions.

Encoding URLs

Paste text containing special characters and click Encode. Spaces become %20 (or + in form data), ampersands become %26, and non-ASCII characters are encoded as UTF-8 byte sequences. "Hello World!" becomes "Hello%20World%21". The encoded string is safe to use in any URL component.

Decoding URLs

Paste a percent-encoded URL and click Decode to see the human-readable version. "%E4%BD%A0%E5%A5%BD" decodes to the Chinese characters for "hello." This is useful for reading URLs copied from browser address bars, analytics tools, or server logs.

Component vs. Full URL Encoding

encodeURIComponent: Encodes everything except A-Z, a-z, 0-9, and -_.~. Use this for query parameter values. It encodes characters like &, =, and / that have special meaning in URLs.

encodeURI: Encodes everything except valid URL characters including :, /, ?, #, &, and =. Use this for encoding a full URL while preserving its structure.

Common Characters and Their Encodings

Space = %20 or +, Ampersand (&) = %26, Equals (=) = %3D, Question mark (?) = %3F, Hash (#) = %23, Slash (/) = %2F, Plus (+) = %2B, Percent (%) = %25. Knowing these common encodings helps when reading and debugging URLs manually.

Frequently Asked Questions

Q: When should I use %20 vs + for spaces?

A: Use %20 in URL path segments and most contexts. Use + only in application/x-www-form-urlencoded data (HTML form submissions). Modern APIs typically expect %20. When in doubt, %20 is the universally safe choice.

Q: Why does my URL break when it contains special characters?

A: URLs have reserved characters with specific meanings (& separates parameters, = assigns values, # marks fragments). If your data contains these characters without encoding, the browser misinterprets the URL structure. Always encode parameter values before constructing URLs.

Q: How do I handle non-English characters in URLs?

A: Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded. The Japanese character "a" (U+3042) becomes %E3%81%82 (three UTF-8 bytes). Modern browsers display these as readable characters in the address bar while transmitting the encoded form.

Advertisement
Advertisement