🔗

URL Encode

Encode text for URLs

Frequently Asked Questions

What is URL encoding?

URL encoding (percent-encoding) converts special characters to a format safe for URLs. Spaces become %20, & becomes %26, = becomes %3D. This ensures URLs are transmitted correctly without ambiguity.

Which characters need to be URL encoded?

Characters with special URL meaning must be encoded when used as data: & (parameter separator), = (key-value separator), ? (query start), # (fragment), / (path separator), and spaces. Non-ASCII characters are always encoded.

How do I encode a URL query parameter?

Encode only the parameter values, not the structure. For key=value&key2=value2: encode the values but keep =, &, and ? as-is. The encoder has a "component" mode that encodes only values, preserving URL structure.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a full URL, preserving :, /, ?, #, &, =. encodeURIComponent encodes everything except letters, digits, and - _ . ~. Use encodeURIComponent for query parameter values, encodeURI for complete URLs.

Does URL encoding handle Unicode characters?

Yes. Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded. "café" becomes "caf%C3%A9" (é = 2 UTF-8 bytes: C3 A9). The encoder handles all Unicode characters correctly.