URL Encoder, Decoder & Parser

Encode text for use in URLs, decode percent-encoded strings, or inspect a full URL's parts.

Input

Output

URL parser

Encode component vs encode full URL

Encode component (encodeURIComponent) escapes everything except letters, digits and -_.!~*'(). Use it for a single query value or path segment, so characters like & and / inside the value can't break the URL.

Encode full URL (encodeURI) keeps characters that give a URL its structure, such as : / ? # & =. Use it for a complete URL that has spaces or non-ASCII characters in it.

Why are spaces sometimes + and sometimes %20?

HTML form submissions (application/x-www-form-urlencoded) encode spaces as +. Everywhere else in a URL a space is %20.