URL Encoder / Decoder
Percent-encode text for safe URL use, or decode URL-encoded strings
Text / URL to Encode
Encoded Output
Common Percent-Encoded Characters
Space → %20
! → %21
# → %23
& → %26
= → %3D
? → %3F
@ → %40
+ → %2B
What is URL Encoding?
URLs can only contain certain ASCII characters. Special characters (spaces, punctuation, non-ASCII) must be percent-encoded — replaced with % followed by two hex digits representing the character's UTF-8 byte value. For example, a space becomes %20, and © becomes %C2%A9.
This tool uses JavaScript's encodeURIComponent(), which encodes everything except letters, digits, and -_.!~*'(). Use this when encoding a query parameter value. If you need to encode a full URL (preserving /, ?, #), use encodeURI() instead.
lightbulb Example
Encode "hello world & more?":
1Space → %20, & → %26
2? → %3F
hello%20world%20%26%20more%3F
quizFrequently Asked Questions
What is URL encoding and why is it needed?
URLs can only safely contain certain ASCII characters. Special characters like spaces, &, =, #, and non-ASCII characters (like Devanagari script) must be percent-encoded: each byte is replaced by a % followed by its hexadecimal value. A space becomes %20, & becomes %26. Without encoding, these characters would be misinterpreted as URL structure.
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes everything except letters, digits, and - _ ! ~ * ' ( ). Use it to encode a single query parameter value. encodeURI leaves URL structure characters (: / ? # & =) unencoded — use it when encoding a full URL while preserving its structure. In practice: always use encodeURIComponent for query parameter values in your code.
Which characters are safe in a URL without encoding?
Unreserved characters are always safe: A–Z, a–z, 0–9, hyphen (-), underscore (_), period (.), and tilde (~). All other characters — including spaces, Unicode, and reserved characters when used as data rather than URL structure — should be percent-encoded. RFC 3986 defines the complete URL syntax and encoding requirements.