Encoding Tools

URL Encoder / Decoder

Encode or decode URL components and structured URLs.

Browser workspace
LOCAL PROCESSING

Input stays in this browser while you use the tool.

About this tool

The URL Encoder / Decoder converts text into a form that is safe to use inside a web address, and converts it back again. This process is called URL encoding or percent-encoding: every character that is not allowed in a URL is replaced by a percent sign followed by two hexadecimal digits. A space becomes %20, and an ampersand becomes %26.

Encoding is needed because a URL may only contain a limited set of characters, and several of them have a special job. A question mark starts the query string, an ampersand separates parameters, an equals sign joins a name to a value and a hash starts the fragment. If your data contains one of these characters, it has to be encoded so that it is read as data and not as part of the URL structure. Letters, digits and the characters -, _, . and ~ are normally left as they are.

The tool works in two scopes. In URL component mode, everything that has a special meaning is encoded, which is what you want for a single value such as a search term or one query parameter. In full URL mode, the structure characters such as :, /, ?, &, = and # are kept so that the address still works. This is the same difference that JavaScript makes between encodeURIComponent and encodeURI. Characters outside plain ASCII, such as accented letters, other alphabets and emoji, are first converted to UTF-8 bytes and each byte is then written as a percent code.

Percent-encoding is a way of writing text safely, not a way of hiding it, and anyone can decode it. The tool runs in your browser, so the text you enter is not sent to the BitToolsKit server.

Use cases

  • Put a value with spaces or symbols into a query string. A search term such as Ada & Co must be encoded, otherwise the ampersand starts a new parameter.
  • Build a link that contains another link. Redirect, callback and return URLs are often passed as a parameter of another URL, so the inner address has to be encoded as a component.
  • Read an encoded URL from a log, an email or an analytics report. Decoding turns long strings of percent codes back into readable text.
  • Check links with accented letters or other alphabets. Browsers display them nicely, but servers and scripts often receive the percent-encoded form.
  • Fix a link that breaks halfway. A link that stops at a # or splits at an & usually has an unencoded character in one of its values.
  • Prepare the subject or body of a mailto link. Line breaks, spaces and symbols in a mailto address need percent-encoding to arrive intact.
  • Debug an API request. Compare the encoded value you send with the value the server reports receiving.

How to use

  1. Choose whether you want to encode or decode.
  2. Choose the scope: a single URL component (a value, a path segment or a parameter) or a full URL. If you are not sure, use the component scope for one value and the full URL scope for a complete address.
  3. Paste your text or URL into the Input box.
  4. Click Run tool.
  5. Read the result in the Output box. If a message appears instead of a result, the input could not be decoded. Check it against the common errors below and run the tool again.
  6. Click Copy output to copy the result, Download to save it, or Clear to start again.

Encode each value on its own and then join the parts into the URL. Encoding a complete query string in component mode would also encode the = and & signs that separate your parameters.

Examples

Example 1: Encode a single value (URL component)

Input:
Ada Lovelace & Co
Output:
Ada%20Lovelace%20%26%20Co

Example 2: Encode a full URL

Input:
https://example.com/search?q=hello world&lang=en
Output:
https://example.com/search?q=hello%20world&lang=en

Example 3: The same URL as a component, to place inside another URL

Input:
https://example.com/search?q=hello world&lang=en
Output:
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den

Example 4: Decode accented characters

Input:
Caf%C3%A9%20%26%20Cr%C3%A8me
Output:
Café & Crème

Example 5: Decode a lone percent sign

Input:
100%
Output:
No decoded result. A message appears because the percent sign is not followed by two hexadecimal digits. To write a literal percent sign in a URL, use %25 (100%25).

Common errors

A message says the URI is malformed, or the text cannot be decoded

A percent sign is not followed by two hexadecimal digits, or a multi-byte character is cut off. Check for a lone % and for incomplete groups such as %E0%A4. Write a literal percent sign as %25.

Encoding a full URL in component mode

Component mode also encodes :, /, ? and &, so https://example.com becomes https%3A%2F%2Fexample.com and no longer works as a link. Use full URL mode for a complete address, and component mode only for a value or a URL placed inside another URL.

Encoding a value in full URL mode

Full URL mode leaves &, =, ?, / and # unchanged, so a value containing them can split into several parameters or be cut off. Encode single values in component mode.

Double encoding, where %20 becomes %2520

The text was encoded twice, so the percent sign itself was encoded. Decode once and check whether the result still contains percent codes. Encode a value only once, just before it goes into the URL.

A plus sign instead of %20 for a space

HTML forms write a space as + in query strings, while percent-encoding uses %20. Many decoders, including the standard JavaScript decodeURIComponent function, leave a + unchanged. If you are decoding form data, replace + with a space first.

Decoding text that was never encoded

Plain text that contains a percent sign, such as 50% off, is not valid percent-encoding and can cause an error or odd results. Decode only text that really came from an encoded URL.

A link stops at the # sign

A hash starts the fragment of a URL, and everything after it is not sent to the server. If the hash belongs to your data, encode it as %23.

One character turns into several percent codes

This is normal. Characters outside plain ASCII are written as UTF-8 bytes, so é becomes %C3%A9 and an emoji becomes four codes.

Decoded text looks garbled

The URL may have been encoded with an older character set such as Latin-1, where é is %E9. Standard URL decoding expects UTF-8. If the source is a legacy system, check which character set it uses.

Extra spaces or line breaks in the input

A space or a line break copied along with the URL is encoded as %20 or %0A and can break the link. Trim the text before you encode it.

Frequently asked questions

What is URL encoding?

It is a way of writing characters that are not allowed, or have a special meaning, in a URL. Each such character is replaced by a percent sign followed by two hexadecimal digits, which is why it is also called percent-encoding.

What is the difference between URL component and full URL encoding?

Component encoding converts every character with a special meaning, including : / ? & = and #, so it suits a single value. Full URL encoding keeps those structure characters, so a complete address still works after encoding.

Which characters are never encoded?

Letters, digits and the characters - _ . ~ are normally left as they are. Everything else, such as spaces and most symbols, is encoded in component mode.

Why does a space become %20?

A space is not allowed in a URL, and its character code is 20 in hexadecimal, so it is written as %20. Form data in a query string often uses a plus sign for a space instead.

Why do accented letters and emoji become several percent codes?

The character is first converted to UTF-8 bytes, and each byte is written as one percent code. The letter é uses two bytes, so it becomes %C3%A9. An emoji uses four bytes.

How do I put a URL inside another URL?

Encode the inner URL in component mode, and then use the result as the value of a parameter, for example in a redirect or callback address.

Is URL encoding the same as encryption?

No. It only makes text safe to use in a URL, and anyone can decode it without a key. Do not use it to protect passwords or private data.

Why does decoding fail with an error?

The most common cause is a percent sign that is not followed by two hexadecimal digits, or a multi-byte character that has been cut off. Fix or remove the broken sequence and try again.

Is my text uploaded to a server?

No. The tool runs in your browser and works on your device. As a general habit, avoid pasting passwords, API keys or private tokens into any online tool.

Related tools

Share this page