Developer Tools

URL Encode

Percent-encode text so it is safe in a URL.

Rate this tool

How to use the URL Encode

  1. Type or paste your text.
  2. Copy the URL-encoded output.

About the URL Encode

Percent-encoding is how a URL carries characters that would otherwise break it or change its meaning. Each unsafe byte is written as % followed by two hex digits — a space becomes %20, an ampersand becomes %26. This tool applies component encoding: it treats your input as a single value destined for a URL, not as a URL in its own right.

That distinction matters more than it sounds. Component encoding escapes the reserved delimiters as well — &, =, ?, #, / and : all get encoded — because inside a parameter value those characters must never be mistaken for structure. So paste one value here, not a whole address: a full URL would come back with its :// and slashes escaped, which is not what you want. Left untouched are letters, digits and a handful of safe marks: - _ . ! ~ * ' ( ). Non-ASCII text is converted to UTF-8 bytes first, so one accented letter becomes two escapes.

One classic trap deserves flagging: a space encodes to %20, yet query strings historically also read + as a space, a convention inherited from HTML form submission. Both live side by side, and a decoder that only knows one of them gets it wrong. Reverse the process with the URL decoder, or split a whole address into its parts with the URL parser. Everything runs in your browser.

Frequently asked questions

Can I paste a whole URL in?

You can, but the result will not be a working URL — the ://, the slashes and the ? would all be escaped, because this encodes your input as a single value. Encode just the parameter value you are inserting, and leave the surrounding URL structure alone.

Should a space be %20 or +?

This tool always produces %20, which is valid everywhere in a URL. The + convention means a space only in query strings and form-encoded bodies, and it is a separate historical convention. If your consumer expects +, replace %20 afterwards — but only in the query string.

Which characters are left alone?

Letters, digits, and the marks - _ . ! ~ * ' ( ). Everything else, including the reserved delimiters & = ? # / and :, is percent-encoded. That is what makes the output safe to drop into a parameter value.

Why did one character turn into several % escapes?

Because percent-encoding works on bytes, not characters, and the text is encoded as UTF-8 first. A character like é is two bytes, so it becomes %C3%A9. Emoji are four bytes and become four escapes.

What happens if I encode text that is already encoded?

You get double-encoding: the % itself is a character that needs escaping, so %20 becomes %2520. This is a common bug when a value is passed through two layers that each encode it. Encode exactly once.