URL Encoder — Percent-Encode Query Values, Paths and Full URLs

Paste text or a URL and choose how it will be used, as a query value, a full URL or form data, to get it correctly percent-encoded so it survives the trip through a link.

Live demo · real result from this tool

Encoded

https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20cr%C3%A8me%26lang%3Dfr

Processed on your device — nothing is uploaded.

How to use the URL encoder

  1. Paste your text into Text or URL to encode.
  2. Choose Encode as: Component (a query value or path segment), Full URL (keeps : / ? # & =), or Form data (spaces as +).
  3. Tick Encode each line separately to encode a list of values in one go.
  4. Copy the Encoded result into your link, code or request.

What it does and when to use it

The punctuation in a URL has jobs to do. A ? starts the query, & separates parameters, = joins a name to its value, # starts the fragment and / separates folders. When those characters appear inside your data, they must be encoded, or the URL will be read wrongly. Spaces and non-English letters are not allowed in a URL at all, so they must be encoded too.

Use the encoder to:

  • Build a search or tracking link whose values contain spaces, & or accented letters.
  • Pass one URL inside another, for example a return address in a login or redirect link.
  • Prepare form data for an API that expects application/x-www-form-urlencoded.
  • Check what a library or browser will produce before you debug a broken link.

To read an encoded link, use the URL Decoder. For binary data or longer text in a URL, Base64URL is often a better fit. To build campaign links with UTM parameters encoded for you, try the UTM Builder.

How it works

The text is converted to UTF-8 bytes. Each byte that is not allowed to appear as-is is written as % followed by its value in hex. Which characters are left alone depends on the option:

  • Component leaves only letters, digits and - _ . ! ~ * ’ ( ) as they are, just like JavaScript’s encodeURIComponent.
  • Full URL also keeps the structural characters : / ? # & = and a few others, like encodeURI.
  • Form data works like Component, but writes spaces as +, as HTML forms do.

Everything runs in your browser.

Worked examples

A value full of reserved characters. “a b&c=d/é” as a component becomes a%20b%26c%3Dd%2F%C3%A9. The space, &, =, / and é are all encoded, so the value can sit safely after = in a query string.

Tidying a full URL. “https://example.com/a b?x=1&y=é” with Full URL becomes https://example.com/a%20b?x=1&y=%C3%A9. The structure stays, and only the space and é change.

Form data. “fish & chips” with Form data becomes fish+%26+chips.

A percent sign. “50% off!” becomes 50%25%20off!, because % itself must be encoded as %25.

Limits and tips

  • Encode each value on its own, then join them with & and =. Encoding a whole finished URL as a component turns its structure into data.
  • Do not encode twice. Running already-encoded text through the encoder turns %20 into %2520.
  • Domain names with non-Latin letters use a different system called Punycode, not percent-encoding.

Frequently asked questions

Which option should I choose?
Use Component for a single value, such as a search term or a path segment. That is the right choice almost every time. Use Full URL only to tidy a complete link that already has the right structure. Use Form data to match what an HTML form sends, with + for spaces.
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent also encodes the characters that give a URL its structure, such as / ? & = and #, which is what a value needs. encodeURI leaves those alone because it expects a whole URL. Using encodeURI on a value that contains & breaks the query string.
Should a space be %20 or +?
A %20 works anywhere in a URL. A + means a space only in form-encoded query strings and is a literal plus elsewhere. If your value contains a real plus sign, it must be encoded as %2B.
Why does é become %C3%A9?
Characters outside basic ASCII are first turned into UTF-8 bytes, and each byte is written as % followed by two hex digits. é is two bytes in UTF-8, so it becomes two percent groups. Most emoji become four.
Do I need to encode a URL that I put inside another URL?
Yes, the whole inner URL, as a single component. Otherwise its colons, slashes, question marks and ampersands would be read as part of the outer URL. That is why redirect links often look like a long string of % codes.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close