Skip to content
devtoolbox.cc

URL Encode / Decode

URL-encode and decode text live in both directions: encodeURIComponent, strict RFC 3986 or full URL, + for spaces, and line-by-line mode.

Runs locally in your browser

Guide

URL encoding explained

URLs may only contain a limited set of ASCII characters. Everything else must be percent-encoded: spaces, non-Latin letters, and & or = inside a value. Each UTF-8 byte is written as % followed by two hex digits. For example, a space becomes %20 and é becomes %C3%A9.

Type in either box: the other one updates as you type.

Which mode should I use?

  • Component (like JavaScript’s encodeURIComponent) escapes reserved characters such as /, ?, & and =. Use it for a single query value or path segment. This is the right choice in most cases.
  • RFC 3986 strict also escapes !, ', (, ) and *. encodeURIComponent leaves these alone, but some APIs and OAuth signatures require them to be encoded.
  • Full URL (like encodeURI) keeps the URL structure (:/?#&=) intact and only escapes what can never appear in a URL. Use it for a complete address.
  • Spaces as + follows HTML form encoding (application/x-www-form-urlencoded). Here a space is +, and a literal plus is %2B, in every mode. With Full URL that means A+B C becomes A%2BB+C, which decodes back to A+B C. Use this option for query strings and form bodies; a plus in a URL path is a literal plus, so leave it off there.
  • Each line separately encodes or decodes a list line by line, keeping the line breaks.

Decoding errors

A % must be followed by two hex digits, and the bytes must form valid UTF-8. If they don’t, you get an error naming the line, and your last good result stays in place.

To take a full URL apart and edit its query parameters, use the URL parser.