URL Encode / Decode β€” Percent Encoding Online | Tinker
← Tinker
Input
Encoded output

Encoding comparison
encodeURIComponent (component)
β€”
encodeURI (full URL)
β€”

encodeURIComponent encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ) β€” use for individual parameters.
encodeURI preserves URL structure chars like : / ? # [ ] @ ! $ & ' ( ) * + , ; = β€” use for full URLs.

URL Encoding Explained

URLs can only contain a limited set of ASCII characters. Any character outside that set β€” including spaces, accented letters, emoji, and many punctuation marks β€” must be percent-encoded (also called URL encoding). Each disallowed character is replaced by a % followed by its two-digit hexadecimal code point.

For example: space becomes %20, & becomes %26, and = becomes %3D.

encodeURIComponent vs encodeURI

FunctionPreservesEncodesUse for
encodeURIComponent()A-Z a-z 0-9 - _ . ! ~ * ' ( )Everything else, including : / ? # & =Individual query parameter values
encodeURI()URL structure chars: : / ? # [ ] @ ! $ & ' ( ) * + , ; =Spaces, accented letters, non-ASCIIA complete URL that already has structure

Common encoding scenarios

ScenarioInputCorrect functionResult
Query parameter valuehello world & moreencodeURIComponenthello%20world%20%26%20more
Full URL with pathhttps://example.com/path?q=1encodeURIUnchanged (already valid)
URL with spaces in pathhttps://example.com/my file.pdfencodeURIhttps://example.com/my%20file.pdf
API parameter with JSON{"key":"val"}encodeURIComponent%7B%22key%22%3A%22val%22%7D

© 2026, Tinker - tools Β· calculators Β· practice games