URL Encoder/Decoder

Cleared

Copied

How URL Encoding/Decoding Works

What is URL encoding?

URL encoding is a method to convert data (characters) with a % followed by two hexadecimal digits format so that the data can be transmitted over the Internet.

For example, a question mark ? becomes %3F.

Why is URL encoding necessary?

URLs can only be safely transmitted over the Internet when they are encoded using the US-ASCII character set).

Characters such as spaces, &, ?, =, and others are not part of the US-ASCII set and can have special meanings within URLs, these characters must be encoded. Without encoding, these characters could be misinterpreted, leading to errors and unexpected behavior.

What is URL decoding?

URL decoding is a method to convert encoded characters back into their original form . This is useful when you need to view/use the original URL.

For example, ? is encoded as %3F. When you decode the text How%3F, you get the original text How?.

Characters Encoding/Decoding Table

CharacterEncodedDecoded
Exclamation Mark%21!
Double Quote%22"
Hash Sign%23#
Dollar Sign%24$
Percent Sign%25%
Ampersand%26&
Single Quote%27'
Left Parenthesis%28(
Right Parenthesis%29)
Asterisk%2A*
Plus Sign%2B+
Comma%2C,
Hyphen/Minus%2D-
Period%2E.
Slash%2F/
Colon%3A:
Semicolon%3B;
Less Than%3C<
Equal Sign%3D=
Greater Than%3E>
Question Mark%3F?
At Sign%40@
Left Square Bracket%5B[
Backslash%5C\
Right Square Bracket%5D]
Caret%5E^
Underscore%5F_
Grave Accent%60`
Space%20

Use of encoding/decoding

  • Encoding search words or phrases in a URL so that spaces and symbols are safely included.
  • Sending data between pages through the URL without causing mix-ups.
  • Working with APIs that require encoded URL parameters
  • Converting back (decoding) the special format to see the original message, which is useful for fixing errors or understanding the data.

Examples

Original: Hello World!

Encoded: Hello%20World%21

Original: https://www.convertchief.com?name=Jack Sparrow&title=Captain

Encoded: https%3A%2F%2Fwww.convertchief.com%3Fname%3DJack%20Sparrow%26title%3DCaptain