URL Encode & Decode

Percent-encode and decode spaces, special characters and non-ASCII text for URLs, with a whole-URL mode. Your text never leaves your browser.

How do I URL-encode text with spaces or special characters?

It percent-encodes and decodes with encodeURIComponent.

Encode, decode and whole URL

Why is a space %20?

This tool follows the encodeURIComponent rule, so a space is always %20. Writing a space as + is the form-submission rule; the standard for URL paths and queries is %20.

More text tools for developers

How this tool calculates

Worked example

Encoding "a b & c" gives "a%20b%20%26%20c": a space is %20 and & is %26. Korean "가" is 3 bytes in UTF-8, so it becomes "%EA%B0%80". These come from running the tool's own encode function, and decoding them returns the original text unchanged.

Things to know before you use it

The full counting rules and the sources for service limits are on Methods and standards.

Frequently asked questions

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent is for a single value (a query value or a path segment), so it percent-encodes delimiters like / ? & = : # as well. encodeURI is for an already complete URL, so it leaves those structural characters alone and only encodes unsafe characters like spaces and non-ASCII letters. Use component for one query value, full for a whole address.

Is a space %20 or +?

This tool follows the encodeURIComponent rule, so a space is always %20. Writing a space as + is the application/x-www-form-urlencoded (form submission) rule; the standard encoding for URL paths and queries is %20. When decoding, a + is read literally as a plus sign.

Why does a broken % input fail?

A % must be followed by two hexadecimal digits. A lone %, something like %G1 that is not hex, or a UTF-8 byte sequence cut off in the middle is not valid percent-encoding and cannot be decoded, so it is reported as an error. Check that the encoded string was not truncated.

Which characters are left unencoded?

In component mode, letters and digits plus - _ . ~ ! * ' ( ) are treated as safe and left as-is. Everything else (Korean, spaces, & = ? # / and so on) is turned into UTF-8 bytes and encoded as %XX.

Is my text sent to a server?

No. All encoding and decoding happens in your browser. Whatever you paste is never sent or stored on a server.

More text tools