URL Encoder/Decoder — Percent-Encode Query Strings Online

URL Encode / Decode Tool

URL Input

Result

1

About the URL Encode / Decode Tool

Overview

A URL full of %XX sequences is unreadable at a glance, and remembering whether encodeURI or encodeURIComponent is the right call for a given string trips up most developers at some point. This tool runs both directions — encode a raw string into percent-encoded form, or decode an encoded one back to plain text — using the exact same JavaScript methods you'd call in code, so the result matches what your app will actually produce.

How to Use

  1. 1Type or paste the text into String to convert — this works whether it's already encoded or still plain text.
  2. 2Set Mode to Encode or Decode depending on which direction you need.
  3. 3Turning on Convert all URL symbols (e.g. / and ?) as well switches to encodeURIComponent behavior, encoding every reserved character. Leave it off to use encodeURI behavior, which leaves URL structure characters like / and ? untouched.
  4. 4Click Convert to see the result, or Clear to start over.

Specifications & Glossary

  • encodeURI: Does not encode characters that are valid in a URL (scheme http://, path separator /, query characters ?, =, &, etc.). Use when passing the entire URL.
  • encodeURIComponent: Encodes all characters except A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use when passing a part of a URL, such as a query parameter value.
  • Percent encoding (RFC 3986): The mechanism behind the %XX notation. Each character is first encoded as UTF-8 bytes, then each byte is written as %XX in hex — a multi-byte character like "あ" expands to multiple %XX groups, e.g. %E3%81%82.
  • Decoding: Supports decodeURI and decodeURIComponent to restore encoded strings back to their original text.
  • Difference between encodeURI and encodeURIComponent: encodeURI does not encode URL structural characters such as :, /, ?, and #, while encodeURIComponent encodes all of them.

Use Cases

  • Encoding non-ASCII text or special characters before putting them into an API request's query parameters.
  • Converting form field values into a URL-safe format before building a query string by hand.
  • Making sense of a long percent-encoded URL from a browser address bar, server log, or bug report.
  • Settling the classic "+ vs %20" confusion: form submissions (application/x-www-form-urlencoded) traditionally encode a space as +, while encodeURIComponent and a URL's path always use %20 — mixing the two conventions is a common source of subtly broken query strings.