URL Encoder / Decoder

Percent-encode or decode a URL / string.

What is URL encoding?

URL (percent) encoding replaces characters that aren't safe to use in a URL (spaces, symbols, non-ASCII characters) with a % followed by their hexadecimal code. This lets you safely include arbitrary text (like a search query or a special character) as part of a URL's query string without breaking the URL's structure.

How to use this tool

Enter a URL or string, then click Encode to percent-encode it with encodeURIComponent(), or Decode to reverse a previously encoded string back to its original form. Copy the result with the clipboard icon.

Common use cases

  • Safely including a search query with spaces or special characters as a URL query parameter.
  • Decoding a percent-encoded URL from a browser address bar or server log to read it clearly.
  • Preparing a redirect URL that itself needs to be embedded as a parameter value.
  • Debugging why a URL with unencoded special characters is breaking a request.

Frequently asked questions

What's the difference between encodeURIComponent and encodeURI?

encodeURIComponent() escapes nearly every special character, including /, ?, and &, making it correct for encoding a single query parameter value. encodeURI() leaves those characters alone since it's meant for encoding a whole URL that already contains its own structural characters. This tool uses encodeURIComponent().

Why do spaces sometimes become + and sometimes %20?

Both represent a space, but in different contexts: %20 is the strict percent-encoding used in URL paths, while + is a convention specific to the application/x-www-form-urlencoded format used in query strings and form submissions. This tool uses %20.

Why did decoding fail with an error?

This usually means the input contains a % that isn't followed by two valid hexadecimal digits, meaning it isn't actually valid percent-encoded text, often because it was already decoded, or never encoded in the first place.