URL Encode / Decode

Encode special characters in a URL string to percent-encoded format, or decode a percent-encoded URL back to plain text.

Mode

Input length
0
Output length
0

URL Encoding Reference

Characters that must be percent-encoded in URLs:

CharacterEncodedDescription
%20Space
!%21Exclamation
#%23Hash / Fragment
$%24Dollar
&%26Ampersand
'%27Apostrophe
(%28Left paren
)%29Right paren
*%2AAsterisk
+%2BPlus
,%2CComma
/%2FForward slash
:%3AColon
;%3BSemicolon
=%3DEquals
?%3FQuestion mark
@%40At sign
[%5BLeft bracket
]%5DRight bracket

Paste a whole link such as https://example.com/a b?x=1&y=2 into this tool and you get https%3A%2F%2Fexample.com%2Fa%20b%3Fx%3D1%26y%3D2, with the colon, slashes, question mark and equals signs all escaped, so it no longer works as an address. The reverse mistake, leaving a raw ampersand inside a value, quietly splits one parameter into two and loses data. Encode only the piece that needs it, such as a search term or a redirect target.

Percent-Encoding Rules, Byte by Byte

The text is first turned into UTF-8 bytes. Each byte outside the safe set becomes a percent sign followed by two hexadecimal digits of the byte value. The safe set, which this tool leaves as it is, is A to Z, a to z, 0 to 9 and the characters - _ . ! ~ * ' ( ). Everything else is encoded, including space, / ? : # & = + and %. A plain ASCII character therefore grows from 1 to 3 characters, é (2 bytes) becomes %C3%A9, the euro sign (3 bytes) becomes %E2%82%AC, and an emoji (4 bytes) becomes 12 characters.

Decoding goes the other way: every %XX is read as one byte, and the bytes are then read as UTF-8. Two details trip people up. A plus sign is not turned into a space, so hello+world%21 decodes to hello+world!. And a truncated sequence such as %E0%A4%A cannot be read, so the output box shows an error message instead of text.

Worked example: the input name=Tom & Jerry/café? is 22 characters. The = becomes %3D (hex 3D is 61), each space becomes %20, & becomes %26, / becomes %2F, é becomes %C3%A9 and ? becomes %3F. The result is name%3DTom%20%26%20Jerry%2Fcaf%C3%A9%3F, which is 39 characters: 15 untouched letters, 6 single-byte symbols at 3 characters each, and 6 for the é. The Output length counter on the page reads 39.

How to Use This Calculator

  1. Pick Encode to escape text or Decode to restore percent-encoded text, using the two tabs at the top.
  2. Paste or type into the large text box; the output appears below it immediately, with no Calculate button.
  3. Check the Input length and Output length counters to see how much the string grew.
  4. Use Copy Output to take the result, or Use as Input to feed it back in, then Clear to start over.

Frequently Asked Questions

Should I encode a full URL or only the value I am inserting?

Only the value. This tool uses encodeURIComponent rules, which escape the separators too, so a complete address comes out unusable. Build the URL normally and run just the parameter value, such as a search phrase or a return address, through the encoder.

The reference table lists ! ' ( ) * as encoded, so why does my output leave them alone?

The table on the right is a general reference for characters that some systems escape. The tool itself follows the browser's encodeURIComponent, which keeps ! ' ( ) * ~ - _ . as they are. If a strict system insists on %21 and similar codes, replace those characters by hand.

Why does space become %20 and not a plus sign?

Percent-encoding uses %20. The plus-for-space habit belongs to HTML form submissions, and decoding here will not convert + back, so form-style data may need its plus signs replaced with spaces afterwards.

What does the invalid encoded string error mean?

A percent sign must be followed by two hex digits, and multi-byte characters must have all of their bytes. A lone %, a cut-off %E2%82 or a stray %ZZ cannot be decoded. A literal percent sign belongs in the text as %25.

What happens if I encode the same text twice?

It is encoded again: %20 turns into %2520, because the percent sign itself is escaped. The Use as Input button makes this easy to do by accident. If a link shows %25 sequences, decode once more.