Skip to content
Browser tool Runs locally

URL Encoder & Decoder

Encode or decode URL components with standard percent-encoding. Runs locally in your browser.

Text or URL component
Encoded URL component
Encoded output will appear here.

What is URL encoding?

URL encoding (percent-encoding) represents characters that aren't permitted or have special meaning in a URL using a % sign followed by two hexadecimal digits - the byte value of that character. It lets you safely include arbitrary text, including spaces, punctuation, and non-ASCII characters, inside a URL without breaking its structure.

How to use this tool

  1. Paste or type the text you want to encode, or a percent-encoded string you want to decode.
  2. Select whether you want to Encode or Decode.
  3. Click the action button and copy the result.

encodeURIComponent vs. encodeURI

encodeURIComponent encodes everything except unreserved characters (letters, digits, - _ . ~), which makes it the right choice for encoding a single value - a query parameter, path segment, or form field - before inserting it into a URL. encodeURI leaves URL syntax characters such as / , ? , & , and # intact, so it's meant for encoding an already-assembled, complete URL rather than a piece of one. This tool uses encodeURIComponent semantics, matching how you'd encode a value going into a query string.

Practical examples

  • Encoding a search query with spaces and symbols, e.g. coffee & tea, before appending it to ?q= in a URL.
  • Building a redirect URL that embeds another full URL as a query parameter, e.g. ?returnTo=https%3A%2F%2Fexample.com.
  • Decoding a percent-encoded value copied from a browser's address bar or a server log to read it in plain text.
  • Encoding a filename or path segment that contains spaces or special characters for a REST API endpoint.

Common mistakes

  • Double-encoding a value that's already percent-encoded, which turns a % into %25 and produces the wrong string when decoded downstream.
  • Using this tool's decode on a form-urlencoded query string that uses + for spaces - those plus signs need to be converted separately, since standard percent-decoding leaves them as literal + characters.
  • Encoding an entire URL with component-style encoding, which also escapes the :// and / separators and breaks the URL.

Frequently asked questions

Is this the same as encoding a full URL?
No. This tool encodes URL components using encodeURIComponent, which escapes characters like /, ?, &, and # that would otherwise be treated as URL syntax. Encoding a complete URL (with encodeURI) leaves those structural characters alone so the URL still works.
Why does a space become %20 and not +?
Percent-encoding (RFC 3986) represents a space as %20. The + character for spaces is a convention specific to the application/x-www-form-urlencoded format used in HTML form submissions and query strings - it's a different, older encoding, not part of standard percent-encoding.
Does a plus sign become a space on decode?
No. This tool performs standard percent-decoding, where a literal + character decodes as +. Only form-urlencoded decoders (like the ones used for query strings) convert + back into a space.
What causes an invalid percent-encoding error?
Either a % character not followed by exactly two hexadecimal digits (e.g. %2 or %ZZ), or a decoded byte sequence that isn't valid UTF-8. Both indicate the input wasn't produced by a standard URL encoder.
When should I encode a value before putting it in a URL?
Any time the value comes from user input or contains reserved characters (spaces, &, =, ?, #, /, +, etc.) and is going into a query parameter, path segment, or form field. For inspecting or constructing multiple query parameters, use the Query String Parser & Builder. Encoding prevents the value from being misread as URL structure or breaking the request.

Related tools