DEVELOPER TOOL

URL Encoder

Encode text safely for use inside a URL.

Result appears here

About URL Encoder

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.

How to use URL Encoder

  1. Click into the large input box and type or paste only the value you want to encode, not the whole address.
  2. Watch the result box under it. The encoded text updates on every keystroke, so there is no separate convert button to press.
  3. Check that spaces now appear as %20 and that reserved characters such as & and = have become %26 and %3D.
  4. Click Copy result to put the encoded text on your clipboard. The text is copied exactly as shown, ready to paste.
  5. Paste it after the equals sign of your query parameter or into the path segment, then assemble the rest of the URL around it.

When this tool helps

Building a search link by hand

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.

Passing a URL inside a URL

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.

Preparing a mailto subject or body

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.

Checking what an API expects

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.

Tips for better results

  • Encode each parameter value separately, then join the pieces with & and =. If you encode the whole query string at once, the joining characters get escaped as well and the server sees one long value.
  • Do not encode twice. A value that is already encoded will have its percent signs turned into %25, so %20 becomes %2520. If you see that pattern in a link, something encoded the text a second time.
  • This tool writes spaces as %20, not as a plus sign. Both appear in form submissions, but %20 is valid everywhere in a URL, so it is the safer choice for paths.
  • Non-English text works fine. The tool encodes characters as UTF-8, which is what current browsers and web servers assume unless told otherwise.
  • If you need to keep the slashes and colons of a full address readable, encode only the parts that vary, such as a file name or a search phrase.

Good to know

  • It encodes components, not complete URLs. There is no mode that leaves :, /, ? and # untouched, so assemble the address yourself after encoding each part.
  • Only the text you type is processed. There is no file input, no batch list, and no option to choose a character set other than UTF-8.
  • A lone half of an emoji or other broken surrogate pair cannot be encoded, and the tool will show an error message instead of a result.

Privacy and your data

Encoding runs entirely in your browser with a built-in JavaScript function. The text you enter is not sent to a server.

URL Encoder FAQ

What is the difference between encodeURIComponent and encodeURI?

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.

Which characters get percent-encoded?

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.

Why does my space turn into %20 instead of a plus sign?

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.

How do I encode a Unicode or emoji character?

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.

Should I encode the whole URL before sharing it?

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.

Why did my encoded text show %2520?

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.

Browse all ELDOSA tools →