URL Encoder
Encode text safely for use inside a URL.
Result appears here
Encode text safely for use inside a URL.
Result appears here
A URL only allows a limited set of characters, and several of the ones you type every day, such as the space, the ampersand, the equals sign and the question mark, already mean something inside a link. When one of those appears in the data you want to pass along, it has to be replaced with a percent sign and two hexadecimal digits. This page does that conversion for you as you type. Typing the value into the box and copying the escaped result saves you from memorizing which punctuation marks are safe and which are not.
The tool applies the same rule as the JavaScript function encodeURIComponent. That is the right choice for a single piece of a URL, like the value of one query parameter or one path segment. Because it escapes slashes, colons, question marks and hash signs too, it is not meant for a complete address. If you paste a full link, the https:// part will be mangled into something no browser will open. Think of it as preparing one ingredient at a time rather than the finished dish.
Letters, digits and a handful of punctuation marks (hyphen, underscore, period, tilde, and a few symbols such as the asterisk and parentheses) are left alone. Everything else, including accented letters, Chinese characters and emoji, is converted to its UTF-8 bytes and written as percent-escapes, which is what servers and browsers expect today. The result box shows the escaped text in uppercase hexadecimal, for example %C3%A9 for the letter e with an acute accent.
You are writing a link such as /search?q=rock & roll. Encode just the value, rock & roll, and paste the result after q=. Otherwise the ampersand would be read as the start of a new parameter. The same applies to any value containing symbols.
Redirect and share links often carry another address in a parameter, like ?next=. Encode the inner address completely so its own slashes, question marks and equals signs are not mistaken for part of the outer link. This keeps the structure of the outer address correct.
A mailto link needs spaces and line breaks escaped in the subject and body fields. Encode the text here, then add it after subject= or body= so the mail app shows your wording intact. Apply the same approach to any link that carries free text.
When a request fails with a 400 error on values containing symbols or non-English letters, encode the raw value and compare it with what your code actually sends. The difference usually points straight at the bug. Seeing the escaped form side by side makes mismatches obvious.
Encoding runs entirely in your browser with a built-in JavaScript function. The text you enter is not sent to a server.
encodeURI is meant for a whole address and leaves characters like :, /, ?, & and # alone so the URL keeps its structure. encodeURIComponent, which this tool uses, escapes those too, making it right for one query value or one path segment but wrong for a complete link.
Everything except letters, digits and the symbols - _ . ! ~ * ' ( ). That means spaces, quotes, angle brackets, slashes, colons, question marks, ampersands, equals signs, hash signs, percent signs and all non-ASCII characters are converted to percent-escapes. Anything not on that list is escaped, even characters that look harmless.
The plus sign for spaces is a convention used only in HTML form submissions. Percent-encoding with %20 is valid in every part of a URL, so this tool uses it. Most servers decode both forms correctly in query strings. Mixing the two styles in one URL is allowed.
Just type or paste it. The character is converted to its UTF-8 bytes and each byte is written as a percent-escape, so a single accented letter usually becomes two escapes and an emoji becomes four. Decoding the result with the URL Decoder page shows you the original again.
Usually not. Encoding a full address turns https:// into https%3A%2F%2F, which browsers will not follow. Encode only the individual values that contain special characters, or the entire address when it is itself a parameter inside another link. A common pattern is to encode the inner URL, then place it after the parameter name.
That means the text was encoded twice. The first pass turned a space into %20, and the second pass turned the percent sign of that escape into %25. Decode once to get back to the single-encoded form, or start again from the original text.