URL Encoder Decoder

Characters in result—

How URL Encoder Decoder is calculated: Encode uses percent-encoding: a space becomes %20, & becomes %26, ? becomes %3F. Decode reverses it. Letters, digits, and - _ . ~ stay unchanged.

What is a URL encoder decoder?

A URL encoder decoder converts text into a form that is safe to put inside a web address, and back again. Encoding turns a space into %20, an ampersand into %26, and a question mark into %3F. The default text on this page — hello world & friends? — encodes to 32 characters, up from 22, and decodes back to the same 22. To pull a finished URL apart, use the URL parser, and if the address is too long to share, a URL shortener makes a compact link.

The need comes up whenever text has to travel inside a link. A search query with spaces, a name with an ampersand, a title with a question mark — none of these can sit raw in a URL, because spaces break links and & and ? have special jobs in an address. Encoding turns them into percent codes the browser reads safely.

This tool encodes and decodes live as you type. Pick Encode to turn text into percent codes, or Decode to turn percent codes back into text. Everything runs in your browser — your text never leaves your device, nothing is stored, and there is no account to create.

How URL encoding works

Encoding replaces every character that is not safe in a URL with a percent sign and two hex digits — the character's code in hexadecimal. A space is code 32, which is 20 in hex, so it becomes %20. An ampersand is code 38, which is 26 in hex, so it becomes %26. A question mark is code 63, which is 3F in hex, so it becomes %3F.

Letters, digits, and four marks — hyphen, underscore, full stop, and tilde — are never encoded, because they are safe in any URL. Everything else is encoded, including spaces, slashes, colons, and non-English letters, which take two or more percent codes each. The default text shows the rule: hello world & friends? keeps its letters and becomes hello%20world%20%26%20friends%3F.

Decoding runs the same rule backwards: each %XX group becomes the character with that code. Decoding then encoding gives back the original text, and the default text proves it: 22 characters in, 32 encoded, 22 back after decoding. If a percent group is broken — a % with no hex digits after it — the tool leaves the text unchanged instead of failing.

Non-English letters show the same rule at a bigger scale. A letter like é is stored as two bytes in UTF-8, and each byte becomes its own percent code, so one letter becomes six characters of output. A short phrase in Hindi or French can double or triple in length when encoded, which is normal — the browser decodes it back to the same letters, and the link still works.

The characters that break a URL

The space is the most common breaker. A URL with a raw space in it is cut off at the space by most programs, so a link to a page called my file.html goes nowhere. Encoding the space to %20 keeps the link whole. The default text has three spaces, and all three become %20.

The ampersand is the most dangerous breaker. In a URL, & separates one query value from the next, so a search for fish & chips would be read as a search for fish plus a second value called chips. Encoding it to %26 keeps the phrase together. The question mark is the same kind of breaker — it starts the query string, so a ? inside a value must become %3F.

The plus sign is the trap that catches people out. In a query string, + means a space, so a search for a+b would be read as a b. Encoding it to %2B keeps the plus. A base64 encoder decoder does a similar job for data that must travel as plain text.

The hash sign is another quiet breaker. In a URL, # starts the fragment — the part that jumps to a section of the page — so a value with a real hash in it, such as C# or item #5, must be encoded to %23. Without encoding, the browser treats everything after the hash as a fragment, the server never sees it, and the value arrives cut short.

A worked example: encoding a search phrase

Take the default text exactly as it sits on the page: hello world & friends?. It is 22 characters long. Pick Encode and the result is hello%20world%20%26%20friends%3F — 32 characters, with three spaces turned into %20, the ampersand into %26, and the question mark into %3F.

Count the growth. Each space grows from 1 character to 3, so three spaces add 6 characters. The ampersand grows from 1 to 3, adding 2, and the question mark grows from 1 to 3, adding 2 more. That is 10 extra characters, and 22 + 10 = 32, which is the number the page shows.

Try a second one. Encode a+b=c and the result is a%2Bb%3Dc — 9 characters, up from 5. Now pick Decode, paste hello%20world back in, and the original comes back: hello world, 11 characters. A JSON formatter tidies the code files that encoded URLs often live in, and a word counter measures the text before and after.

Who uses a URL encoder decoder, and why

Web developers are the biggest users. Every link built from user input needs encoding — a search box, a share link, a redirect. A developer who builds a link from raw text watches it break on the first space or ampersand, and spends an hour finding why.

Marketers are the second group. Tracking links carry campaign names with spaces and ampersands, and an unencoded tracking link loses the campaign data. A marketer who encodes the link keeps the data; one who does not wonders why the numbers are wrong.

Anyone who shares a link is the third group. A file name with spaces, a document title with a question mark, a name with an apostrophe — all of them break when pasted raw into a message. The tool on this page handles all three uses — paste, pick a mode, copy — which covers most of what anyone needs.

App developers are a fourth group, and they encode values that travel between screens. A username with a space, a city name with an accent, a search term with a hash — each one is a value inside a link or a request, and each one must be encoded before it is sent. One unencoded value can break the request, and the error it gives back rarely says which value was at fault.

URL encoder vs base64 encoder

A URL encoder and a base64 encoder both make text safe to move, but they protect against different things. URL encoding protects the characters that have special jobs inside an address — spaces, ampersands, question marks. Base64 encoding protects whole bytes so binary data can travel inside text.

The same text-tools family on this site does both jobs. A base64 encoder decoder turns any text into base64 and back, which is the right pick when the problem is binary data or a token. This tool is the right pick when the problem is a link, a query string, or a file name in a URL.

The practical rule is simple: if the text is going into a URL, encode it as a URL. If the text is going into a file or a header that only accepts plain letters and numbers, use base64. And a JSON formatter answers the next question developers ask: is the file the encoded link lives in valid?

Common URL encoding mistakes

The most common mistake is encoding a whole URL instead of one value. Encoding https://example.com/search?q=hello world turns the slashes and the colon into percent codes too, and the link breaks. Encode only the value — hello world — and leave the rest of the address alone.

Second: encoding twice. Encoding hello%20world again turns the % into %25, giving hello%2520world, which decodes to hello%20world instead of hello world. If a link shows %25 in it, it was encoded twice. Decode once and the text comes back.

Third: forgetting the plus sign. A + in a query string means a space, so a value with a real plus in it must be encoded to %2B. A search for C++ that is not encoded arrives as C , which is not the same search at all.

Fourth: decoding text that was never encoded. Decoding plain text with a % in it can turn %20 into a space when the text was meant to show %20. Decode only text that was encoded, and encode only text that needs to travel in a URL.

How to use this URL encoder decoder

Using this tool is simple. Paste your text into the box, or type it directly. Pick Encode to turn unsafe characters into percent codes, or Decode to turn percent codes back into text. The result appears instantly in the output box, with its character count shown above it. There is no button to press.

To try the other direction, pick the other mode and watch the output change. To encode a second piece of text, select all, delete, and paste the new one. If your text needs both directions, copy the result of the first, paste it back into the input, and pick the second mode.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — your text never leaves your device. It works offline once the page has loaded, so you can use it on a plane or anywhere else you build links. Try it with something real before you need it: paste a search phrase with spaces, encode it, and see the percent codes.

Frequently Asked Questions

It means a space. Encoding replaces a space with a percent sign and the hex code 20, which is 32 in decimal — the character code for a space. The default text hello world & friends? has three spaces, and all three become %20 when encoded.

Because & separates query values in a URL. A search for fish & chips would be read as a search for fish plus a second value called chips. Encoding it to %26 keeps the phrase together, and the server reads it back as one value.

Yes, character for character, as long as the text was encoded once. The default text is 22 characters, encodes to 32 characters, and decodes back to the same 22 characters. Encoding twice adds %25 codes and breaks the round trip.

Yes. Everything runs in your browser — your text is never uploaded, stored, or sent anywhere. You can use it offline once the page has loaded, and you can paste a link or a query without worrying about who sees it.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.