Toolium

URL Encoder / Decoder

Encode or decode a URL component or a whole URL, instantly

100% client-sideFree, no signup

Escapes everything that is not unreserved, including : / ? # & =. Use this for a single query value or path segment.

Percent-encoding without the guesswork

A URL has a small legal alphabet: letters, digits, and a few safe symbols. Everything else, spaces, accents, ampersands, CJK characters, has to be percent-encoded. The tool encodes text into URL-safe form and decodes it back, handling UTF-8 so non-English characters survive the round trip.

encodeURI versus encodeURIComponent

JavaScript ships two encoders that trip up nearly everyone. encodeURI assumes it holds a whole URL and leaves the structural characters alone, the colon, slash, question mark, hash, equals, and ampersand. encodeURIComponent assumes it holds one value going inside a URL and encodes everything with URL meaning, including the question mark, equals, and ampersand. Reach for encodeURIComponent when you drop a search query, a path segment, or any user-supplied value into a URL, and save encodeURI for the rare case of nudging an already-built URL that has a stray space in it.

What the encoded form looks like

Each encoded character is a percent sign and two hex digits: a space is %20, an at sign %40, a hash %23, a plus %2B. A non-ASCII character encodes one UTF-8 byte at a time, so a single Japanese character lands as three percent sequences in a row, because it occupies three bytes.

Encoding questions

Which encoder should I default to?
encodeURIComponent for almost everything, any time a user-supplied value goes into a URL. encodeURI only when you already hold a full URL that needs a light touch-up. When unsure, encodeURIComponent.
My URL was encoded twice. How do I fix it?
Double encoding turns a plus into %2B and then into %252B. Decode twice to recover the original. The tool does not detect this for you, so run decode again if the result still looks encoded.