NinjaFunction (Ninja Function) logo

URL Encoder / Decoder

Encode or decode URLs and query strings. Choose a single value or a whole link, and read parameters in a table. Free and private.


Encodes everything unsafe, including / ? & = : and #. Use it for one piece, such as a search term.

56 characters in · 83 out

About This Tool

NinjaFunction's URL Encoder / Decoder turns text into percent-encoding and back, in your browser. Choose whether you are encoding a single value, such as a search term, or a whole link that should keep its slashes and question marks. Options cover + or %20 for spaces and encoding each line on its own. When decoding, broken parts such as a stray % are left as typed instead of causing an error, and a table shows the name and value of every query string parameter. Nothing you paste is uploaded.

🔑 How to Use

  1. Pick Encode or Decode with the buttons at the top.
  2. Paste your text or link in the left box. The result appears on the right as you type.
  3. When encoding, choose what you are encoding. A single value for something like a search term, or a whole URL if you only want spaces and special letters made safe.
  4. When decoding, tick the + option if the text came from a form or a query string where + stands for a space.
  5. Copy the result, or press Use as input to run it back the other way and check it.

💡 Pro Tips

  • ✔ Encode the pieces, not the finished link. Encode each value on its own, then join them with ? and &. Encoding a finished link with the value mode turns every slash into %2F and breaks it.
  • ✔ Decode once. If you still see %25 after decoding, the text was encoded twice. Press Use as input and decode again.
  • ✔ Paste a full link in Decode mode and the parameters appear in a table below, with names and values already decoded. It is the quickest way to read a long tracking link.
  • ✔ Working with tokens or encoded files? See the Base64 Encoder / Decoder and the JWT Decoder.

Why URLs Need Encoding

A URL is allowed to contain only a short list of characters: letters, digits, and a few marks such as - _ . and ~. Everything else is either not allowed at all or already has a job. The question mark starts the query string, the ampersand separates parameters, the equals sign joins a name to its value, and the hash points to a part of the page. If your data contains one of those, the receiving server cannot tell whether you meant the character or the structure.

Percent-encoding fixes this. Each unsafe character is replaced by a percent sign and the two-digit hexadecimal code of its byte. A space is byte 32, which is 20 in hexadecimal, so it becomes %20. Characters outside basic English are first converted to UTF-8, and each of their bytes is written out, which is why one letter can turn into six characters.

A Value or a Whole URL?

This is the choice that trips people up, because JavaScript has two functions that look alike. encodeURIComponent is for a single piece of text. encodeURI is for an address that already has its structure in place. The tool calls them "A value" and "A whole URL".

InputAs a valueAs a whole URL
hello worldhello%20worldhello%20world
a&b=ca%26b%3Dca&b=c
https://x.com/a b?q=1https%3A%2F%2Fx.com%2Fa%20b%3Fq%3D1https://x.com/a%20b?q=1
cafécaf%C3%A9caf%C3%A9

Use the value mode when the text is going inside a link, for example the address you pass as a redirect parameter. Use the whole URL mode when someone gave you a link with spaces in it and you only want it to be valid.

Common Characters and Their Codes

CharacterCodeWhy it matters
Space%20Cannot appear in a URL; also written + in form data
&%26Separates query parameters
=%3DJoins a parameter name to its value
?%3FStarts the query string
#%23Starts the fragment; the server never sees what follows it
/%2FSeparates path segments
+%2BWould otherwise be read as a space in form data
%%25The escape character itself

Where You Will Meet This

  • Tracking links. A campaign name like "Diwali sale & offers" must be encoded before it goes into a utm_campaign parameter, or the report will cut it at the ampersand.
  • Login and payment redirects. The address you want the user sent back to is itself a URL, and it has to be encoded as a value inside the first one.
  • Email links. A mailto: link with a subject or body needs spaces and line breaks encoded, or mail programs show them wrongly.
  • Sharing text in other languages. Links with Hindi, Arabic or Chinese words work, but they travel as long percent sequences. Decoding shows what they say.
  • API calls. Query parameters with spaces, plus signs or special symbols often fail silently if they are not encoded.

Mistakes That Waste an Afternoon

  • Double encoding. Frameworks and HTTP libraries often encode parameters for you. If you encode first, you end up with %2520. Check what your code already does before adding a step.
  • Using + in a path. In /my+file the plus is a real plus sign. Only query strings and form bodies read it as a space.
  • Encoding the whole link as a value. The colons and slashes in https:// are turned into codes and the link stops working as an address.
  • Forgetting the fragment. Everything after # stays in the browser and is not sent to the server, so putting data there and expecting the server to read it will not work.
  • Decoding twice. A literal % in the original text appears as %25 after encoding. Decoding it a second time can damage text that was meant to contain a percent sign.

Frequently Asked Questions

What is the difference between %20 and + for a space?

%20 is the standard percent-encoding of a space and works everywhere in a URL. The + sign means a space only in form data (application/x-www-form-urlencoded), which is what you get from an HTML form or a query string. In a URL path, a + is a real plus sign. When in doubt, use %20.

Which one should I use: a value or a whole URL?

If you are putting text inside a link, such as a search term, a redirect address or a name, choose "A value". That encodes / ? & = and # too, so the text cannot break the link. If you already have a complete address with spaces or accented letters in it and only want it made safe, choose "A whole URL", which leaves the structure alone.

Why does my link now contain %2520?

It has been encoded twice. The first pass turned a space into %20, and the second pass turned the % into %25, giving %2520. Decode it once to get %20 back, and make sure only one step in your code or tool encodes the value.

Why does decoding show an error about a part that could not be decoded?

A % must be followed by two hex digits, so text like 100% or %zz is not valid encoding. Instead of throwing everything away, the tool decodes what it can and leaves the broken part as you typed it, with a note telling you how many places were skipped.

How are non-English letters and emoji encoded?

They are first turned into UTF-8 bytes, and every byte is written as %XX. So ü becomes %C3%BC, the Hindi letter क becomes %E0%A4%95, and the smiling face emoji becomes %F0%9F%98%80. Modern browsers show the readable form in the address bar but send the encoded form.

Is there a maximum URL length?

The standards do not set one, but in practice about 2,000 characters is a safe limit for links that will be shared or opened by many programs. Browsers accept more, but some servers, proxies and email clients cut long URLs. Encoded text is longer than the original, since every special character becomes three or more.

Is the text I paste sent to a server?

No. Encoding and decoding use functions built into your browser, so nothing is uploaded or stored.

Always FreeAll tools are 100% free to use.
No Sign UpNo registration or login required.
Blazing FastInstant results, always.