Pixel and Prose

URL Encode and Decode: percent-encoding

Updated
Cover image for "URL Encode and Decode: percent-encoding" – Pixel and Prose

Encode text for safe use in a URL or decode percent-encoded strings such as %20 and %C3%A9 back to readable text. Choose whether to encode a single query value or a whole address.

Encode mode

Everything runs in your browser, so links that contain tokens or personal details are never sent anywhere.

Which mode should I use?

Query value or path part encodes every character that has a special meaning in a URL, including / ? & = #. Use it for a single value you are inserting into a link, such as a search term: café & tea becomes caf%C3%A9%20%26%20tea.

URL Encode turning café & tea into caf%C3%A9%20%26%20tea

Whole URL keeps the characters that give a URL its structure and only encodes spaces, accented letters and other unsafe characters. Use it when you have a complete address and want to make it valid without breaking it.

To turn a finished link into a code people can scan with a phone, use the QR code generator. To write words as a lowercase slug, the case converter has a kebab-case option.

URL Encode in whole URL mode: slashes, question mark and equals sign kept, space and é encoded

Frequently asked questions

Why do spaces sometimes appear as + instead of %20?

HTML forms send spaces as + in the query string. Both forms are common, so when you decode text copied from a form submission, tick "Treat + as a space". Leave it off for other URLs, where a + can be a real plus sign.

Why did decoding fail?

A percent sign must be followed by two hexadecimal digits, and the bytes must form valid UTF-8. A stray % in the text, or a link that was cut in the middle of an encoded character, causes an error. The message tells you where.

Is URL encoding the same as encryption?

No. It only makes text safe to put in an address. Anyone can decode it.