Advertisement
What is a URL encoder? A URL encoder replaces characters that are not safe in a web address with a percent sign and two hex digits, so a space becomes %20 and an ampersand becomes %26. This tool uses the browser functions encodeURIComponent and encodeURI to encode, and decodeURIComponent and decodeURI to decode, entirely in your browser.

What is a URL encoder?

A URL can only carry a limited set of characters. Spaces, ampersands, non-English letters and a few symbols have to be rewritten as % followed by hexadecimal bytes. This is called percent-encoding. Skip it and a search link like ?q=bread & butter breaks, because the ampersand is read as the start of a new parameter.

This URL encoder and decoder wraps four JavaScript functions. Choose Encode URL or Decode URL, then pick the Encoding Type. Component uses encodeURIComponent and encodes nearly everything, including & = ? / # :. It is the right choice for a single value, such as a query parameter. Full URL uses encodeURI and leaves those structural characters alone, so a whole address keeps working.

With Live mode ticked, the output updates on each keystroke. Below the tool, a short reference table lists ten common characters and their codes. One difference from HTML forms: spaces become %20, never +, and decoding does not turn + back into a space.

How to encode and decode a URL

  1. Click Encode URL to percent-encode text, or Decode URL to turn %20-style codes back into readable characters.
  2. Under Encoding Type, choose Component for a single value such as a search term, or Full URL for a complete address you want to keep intact.
  3. Paste your text or link into the left box. With Live mode on, the result appears on the right immediately.
  4. If Live mode is off, or you change the mode or type after typing, click the main Encode or Decode button to run it again.
  5. Click Copy above the output. The button briefly shows Copied.
  6. Use Swap to move the output into the input and flip between encode and decode, or Clear to start over.

What this URL encoder and decoder offers

Component and Full URL modes

Two radio options map to encodeURIComponent and encodeURI, so you can choose between encoding every special character and preserving URL structure.

Encode and decode

The same two modes work in reverse with decodeURIComponent and decodeURI.

Live mode

A checkbox, on by default, recalculates the output on every keystroke in the input box.

Character counts

A line under the tool shows the input and output lengths, which makes it easy to see how much a string grew.

Reference table

A table lists space, &, =, ?, #, /, +, @, : and % with their encoded forms and what each is used for.

Swap and Copy

Swap checks round trips in one click, and Copy puts the result on the clipboard.

Who uses it, and for what

  • Developers building query strings. Encode a user-entered value in Component mode before adding it after ?q=, then check that an ampersand or hash does not split the URL.
  • SEO and analytics people. Decode a long tracking link or a Google Analytics campaign URL to read the real parameters. To compare final addresses, see the redirect checker.
  • Marketers writing share links. Encode the destination URL placed inside another link, such as a redirect or a social share URL, so it survives as a single parameter.
  • WordPress and site admins. Make sense of file names with %20 or accented characters in a path, or encode a name before pasting it into a rule. For page paths, the slug generator makes clean ones.
  • QA testers. Paste odd characters, emoji or unicode and see the exact UTF-8 percent sequence a server will receive.

Tips and common mistakes

  • Use Component mode for a value inside a URL, and Full URL mode for a whole address. Encoding a full link in Component mode turns https:// into https%3A%2F%2F, which is correct only if the link will itself be a parameter.
  • Never encode twice. Encoding %20 again gives %2520, which is a common cause of broken links.
  • Decode gives an Error: URI malformed message when the text has a lone percent sign or an invalid sequence like %E4%B8. Check for a cut-off code.
  • Full URL decode leaves codes for reserved characters such as %2F and %3F encoded on purpose. Use Component decode to expand them.
  • Plus signs in query strings often mean a space. This tool does not convert + to a space, so replace them first if you are decoding form data.
  • When using Base64 text in a URL, remember to percent-encode it, or use the Base64 encoder and decoder to check the raw value.

Is it safe? Privacy and limits

Encoding and decoding use built-in browser functions on the page. The text you enter is not sent to a server by this tool and is not stored. Be careful with URLs that carry tokens, session IDs or personal details: decoding makes them readable, so do not share the output publicly. The tool does not check whether a link works or is safe, and encoding does not hide or protect anything.

URL encoder FAQ

URL encoding, also called percent-encoding, rewrites characters that are unsafe or have special meaning in a web address as a percent sign plus two hexadecimal digits. A space is %20, an ampersand is %26, and an accented letter like é becomes two bytes, %C3%A9. It lets any text travel inside a link without being confused with the link's own punctuation. Browsers and servers decode it back automatically. The rules come from the URL standard, RFC 3986, which lists the characters that never need encoding.

Component mode uses encodeURIComponent and encodes everything except letters, digits and a few marks such as - _ . ! ~ * ' ( ). That includes : / ? # & =. Full URL mode uses encodeURI, which keeps those structural characters. Use Component for a value you will put inside a URL, like a search term. Use Full URL for an entire address that has a few unsafe characters, such as spaces in a path. Mixing them up is the usual cause of links that either break or become unreadable.

This tool follows the percent-encoding rule used by encodeURIComponent, which always writes a space as %20. The plus sign is a convention from HTML form submissions in query strings. Servers usually accept both in a query, but %20 is safe everywhere, including in a path, where a plus is a real plus. If your target system needs plus signs, replace %20 with + in the output by hand. Both forms decode to the same text on the receiving side.

The input has a percent sign that is not followed by two valid hexadecimal digits, or a sequence of bytes that is not valid UTF-8. Common causes are a copied link that was cut off in the middle of a code, a stray % in plain text such as 50%, or text that was encoded with a different character set. Fix or encode the lone percent as %25 and try again.

No. decodeURIComponent and decodeURI leave + as it is, because a plus is only a space in form-encoded data, not in general URLs. If you are reading a query string produced by an HTML form, change plus signs to spaces yourself before decoding, or after. This is the most common reason for a decoded search term that still looks wrong. Many search boxes and PHP scripts do this conversion on their own, so the problem mostly shows up when you decode by hand.

When you build a link in code, a spreadsheet or a template and part of it comes from user input or from a title. Encode the value, not the whole link, so characters like &, # and = do not change its meaning. Many frameworks do it for you, but checking a sample here is a quick sanity test. Do not encode a link that is already encoded. Encode again only if the result will be nested inside another URL.

Yes. The browser first converts the characters to UTF-8 bytes and then percent-encodes each byte. The Chinese character 中 becomes %E4%B8%AD and a single emoji usually becomes four bytes. Decoding reverses it. A lone surrogate half of an emoji, which is invalid text, makes encoding fail with an error. Normal text and pasted emoji work without problems. Mind that the byte length of the output depends on the character, so non-English text grows quickly when encoded.

Live mode updates on typing in the input box only. If you switch between Encode and Decode, or between Component and Full URL, the output does not change until you edit the input or click the main button. The Swap button flips the mode, so run the button afterwards if the output looks stale. Turning Live mode off lets you paste a long string and run it once. This is a small quirk, not a bug, but it is worth knowing when a result looks out of date.

Advertisement