DevToolBoxGRATIS
Blog

URL Encode Online

Encode text for safe use in URLs. Toggle between encodeURIComponent and encodeURI modes with real-time encoding as you type.

URL encoding (percent encoding) converts characters that are not allowed in URLs into percent-encoded format (%XX). This free online URL encoder supports both encodeURIComponent (for query values, path segments) and encodeURI (for complete URLs). Characters are encoded in real-time as you type.

encodeURI vs encodeURIComponent

JavaScript provides two functions for URL encoding. They differ in which characters they encode. Choose the right one based on your use case.

encodeURI()

Encode a complete URL (preserves structure: ://?#&=)

encodeURIComponent()

Encode a URL component (query parameter value, path segment)

CharacterencodeURIencodeURIComponent
space%20(Encoded)%20(Encoded)
!!(Not encoded)!(Not encoded)
##(Not encoded)%23(Encoded)
$$(Not encoded)%24(Encoded)
&&(Not encoded)%26(Encoded)
++(Not encoded)%2B(Encoded)
,,(Not encoded)%2C(Encoded)
//(Not encoded)%2F(Encoded)
::(Not encoded)%3A(Encoded)
;;(Not encoded)%3B(Encoded)
==(Not encoded)%3D(Encoded)
??(Not encoded)%3F(Encoded)
@@(Not encoded)%40(Encoded)

FAQ

Why do URLs need to be encoded?
URLs can only contain a limited set of ASCII characters. Characters like spaces, non-ASCII characters (Chinese, Arabic, emoji), and reserved characters (&, =, ?, #) used as data must be percent-encoded to be safely transmitted. Without encoding, these characters could break URL parsing or cause ambiguity.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL while preserving URL structure characters like :, /, ?, #, &, and =. encodeURIComponent encodes everything except A-Z, a-z, 0-9, -, _, ., !, ~, *, ', (, and ). Use encodeURI for full URLs; use encodeURIComponent for individual query parameter values or path segments.
How are spaces encoded in URLs?
In standard URL encoding (RFC 3986), spaces are encoded as %20. In HTML form data (application/x-www-form-urlencoded), spaces can also be represented as +. The encodeURIComponent function always encodes spaces as %20. When building query strings manually, %20 is the safer choice for maximum compatibility.
𝕏 Twitterin LinkedIn

Valuta questo strumento

3.7 / 5 · 147 valutazioni

Resta aggiornato

Ricevi consigli dev e nuovi strumenti ogni settimana.

Niente spam. Cancella quando vuoi.

Enjoy these free tools?

Buy Me a Coffee