URL Encoder / Decoder
About this tool
Encode or decode characters that cannot appear in URLs (full-width characters, spaces, symbols) using URL encoding. Switch between encodeURIComponent (for parts of a URL) and encodeURI (for an entire URL). An option is also available to convert spaces to +
. All processing takes place locally in your browser (no data is sent).
URL encode / decode
→ Encode everything needed for URL components such as query values or individual path segments.
→ Encode only what is necessary so an existing full URL remains intact.
—
Mode differences
- encodeURIComponent is ideal for URL components (query values, path segments, fragment values, etc.). It encodes almost everything except
-_.!~*'()
, so characters like:
,/
,?
,#
,&
, and=
are converted. - encodeURI should be used for complete URLs; it leaves characters meaningful in URL syntax (such as
:/?#&=,+;$
) untouched so protocols and separators remain valid. - Enable “Convert spaces to
+
” when you need form-compatible encoding. During decoding the tool will normalize+
back to spaces.
// Example: encode "a/b?x=1 2"
encodeURIComponent("a/b?x=1 2")
// → "a%2Fb%3Fx%3D1%202"
encodeURI("https://ex.com/a/b?x=1 2")
// → "https://ex.com/a/b?x=1%202" (:/?= stay, only the space becomes %20)
Notes
- Use encodeURIComponent for parts of a URL, and encodeURI for whole URLs.
+
is often treated as a space in form submissions (this tool normalizes it to a space when decoding).- The encoded length can change significantly, especially for multi-byte UTF-8 characters.