toolbench.onlineby Valkyron Labs

Encode / Decode

URL Encode / Decode

Percent-encode or decode text with encodeURIComponent and decodeURIComponent. Spaces become %20. Invalid escapes are reported. Nothing is uploaded.

URL Encode / Decode

Percent-encode or decode text with encodeURIComponent.

Result

No output yet.

Output actions

Ready to copy output once your result appears.

Encode and decode modes

URL Encode / Decode runs encodeURIComponent or decodeURIComponent on the text you paste. Encode is the mode when the page opens. A space becomes %20, not a plus. Reserved characters such as &, =, and ? are escaped. Decode reverses a valid percent-encoded string and leaves a literal plus sign as a plus sign. A broken % sequence is reported in the result box.

How to encode or decode

  1. 1Choose Encode or Decode. The field label switches between Text to encode and Encoded text to decode.
  2. 2Paste the text. Encode will escape it. Decode expects percent-encoding, not a form body that uses + for spaces.
  3. 3Click Run, then Copy output. There is no download button. An empty box sets the result to Provide text to transform.

What it is good for

  • • Escaping one query value before you place it in a URL.
  • • Reading a percent-encoded value copied out of a log or a cURL line.
  • • Seeing the exact failure string when a % sequence is not valid.

Example

Input

a b&c=d?

Output

a%20b%26c%3Dd%3F

Encode mode. The space is %20, the ampersand is %26, the equals sign is %3D, and the question mark is %3F. Decode of that output returns a b&c=d?.

Which characters change

Encode calls encodeURIComponent. Unescaped characters are A–Z, a–z, 0–9, hyphen, underscore, period, exclamation mark, tilde, asterisk, single quote, and parentheses. Everything else becomes a percent sequence of UTF-8 bytes. A space is %20. café becomes caf%C3%A9 because é is the two UTF-8 bytes C3 A9. This is not encodeURI, so slashes, question marks, and colons in a full URL are escaped too. Pasting https://toolbench.online/tools encodes the : and the slashes. If you only meant to escape a query value, paste the value by itself.

Decode calls decodeURIComponent. %20 becomes a space. %26 becomes &. A sequence that is not two hex digits, or a lone %, throws, and the result box is set to Input could not be decoded. Ensure percent-encoding is valid. The page does not throw a browser alert. It also does not try to decode the rest of the string after the bad sequence.

Encode and decode are separate modes

The two buttons are Encode and Decode, in a group labeled URL mode. One is active at a time. Switching the mode does not rerun the conversion; click Run after you switch. The placeholder in Encode is name=John Doe&role=admin. The placeholder in Decode is the percent-encoded form of that same sentence. Placeholders are hints, not a loaded sample. The box starts empty.

Copy output copies the result text, including the two fixed messages for an empty box and a bad decode. Those messages are the output, so copying them is possible. There is no Download output control on this tool. The result heading is Result, and before the first run the preview says No output yet. while the copied value is still empty.

Jobs for a percent-encoded value

Put a single parameter value through Encode when it may contain a space, an ampersand, or a non-ASCII character, then place the escaped text into the query string yourself. After a URL exists, the URL parser splits the components and shows decoded parameters, including repeated keys. Encoding and parsing are separate clicks.

HTML entities such as & are not percent-encoding. Those belong on the HTML encoder. Binary-to-text for a file is Base64. A \u escape is the Unicode escape tool. When the encoded value is sitting inside a copied browser request, the request-to-code guide is the path that turns that cURL line into Python or fetch. Percent-encoding the query value is the step before that URL is trustworthy, not a step the cURL converter performs for you.

Plus signs, full URLs, and bad escapes

application/x-www-form-urlencoded often writes a space as +. decodeURIComponent does not treat + as a space, so decoding a+b returns a+b, not a b. Encode of a space never emits +. If you are reading a form body, replace + with %20 yourself before Decode, or expect the plus signs to remain.

Encoding an entire URL is usually the wrong scope, because the scheme and the path separators become %3A and %2F and the result is no longer a URL you can open. Encode the value. Leave the structure alone. A hash character is escaped as well, so a fragment marker will not survive Encode.

Invalid examples that hit the error sentence include a trailing %, %ZZ, and %C3 without the following byte. The sentence is exactly Input could not be decoded. Ensure percent-encoding is valid. Encode mode does not produce that sentence; it always returns a string. An empty input in either mode returns Provide text to transform. and does not call the encoding function.

Rules and limitations

Encode uses encodeURIComponent. Decode uses decodeURIComponent. Space becomes %20. A plus sign is left as + on decode and is escaped if you encode it. The unescaped set is the encodeURIComponent set, not the encodeURI set.

Empty input yields Provide text to transform. A bad percent sequence yields Input could not be decoded. Ensure percent-encoding is valid. There is no download. Copy output copies the result box, messages included.

Common problems

If a decoded form body still contains plus signs, those pluses were spaces in the form encoding and this decoder does not convert them. Swap + for %20 and decode again, or decode only the pieces that were percent-encoded.

If a full URL came back with %3A and %2F, Encode was applied to the whole URL. Paste only the query value. If Decode shows the error sentence, the % sequences are truncated or use non-hex digits.

Frequently asked questions

Does a space become %20 or a plus?

Encode turns a space into %20. It does not emit +. Decode turns %20 back into a space and leaves a literal + character as +.

Will a full URL keep its slashes?

No. This mode is encodeURIComponent, so :, /, ?, #, and similar characters are escaped. Paste the query value alone when the URL structure should stay intact.

Does decode treat + as a space?

No. decodeURIComponent does not use form-urlencoded rules. a+b decodes to a+b. Convert pluses to %20 first if they were spaces in a form body.

What appears when the percent sequence is invalid?

The result box shows Input could not be decoded. Ensure percent-encoding is valid. A lone %, %ZZ, and a truncated UTF-8 sequence all take that path. Empty input instead shows Provide text to transform.

Is my input uploaded or saved?

This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.

About this tool

Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.

Guides

Next steps

Related tools

Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.

Trust

Policies, contact, and answers

Clear pages for how Toolbench works, what we collect, and how to reach us.