URL Encoder / Decoder

Encode and decode URLs and text using standard percent encoding directly in your browser.

0 characters

0 characters

Operation
Encode
Input length
0
Output length
0

Whether you're building a query string, debugging a link that broke because of a stray space or ampersand, or just trying to read what a percent-encoded URL actually says, this tool encodes and decodes text using standard percent encoding - instantly, entirely in your browser, using the same native APIs your own code would call.

What is URL encoding?

URL encoding (percent encoding) replaces characters that aren't safe to use directly in a URL - spaces, &, =, non-ASCII letters, and more - with a % followed by two hex digits representing that character's byte value, so Hello World! becomes Hello%20World%21. It exists because a URL has its own reserved punctuation (like & and = separating query parameters) that would otherwise be ambiguous if it appeared inside a value too.

Common use cases

  • Building a query string parameter that might contain spaces, symbols, or user-typed text.
  • Safely embedding a URL (as a value) inside another URL, like a redirect or callback parameter.
  • Debugging a broken link by decoding it back into something readable.
  • Preparing text for an API that expects application/x-www-form-urlencoded data.

encodeURI() vs. encodeURIComponent()

JavaScript actually has two native encoding functions, and mixing them up is a common source of bugs. encodeURI() is meant for encoding a WHOLE URL, so it leaves characters like :, /, ?, &, and = untouched (they're structurally meaningful in a full URL). encodeURIComponent() - what this tool uses - is meant for encoding a single VALUE that will be placed inside a URL (like one query parameter), so it encodes those same characters too, since inside a single value they're just data, not structure. Using encodeURI() on a query parameter value would fail to escape a & or = the value happens to contain, silently corrupting the URL's structure.

Examples of URL encoding

  • Hello World! → Hello%20World%21
  • name=John & age=25 → name%3DJohn%20%26%20age%3D25
  • café → caf%C3%A9

Frequently asked questions

Why does encoding "!" turn it into %21 here, but not everywhere?

JavaScript's own encodeURIComponent() deliberately leaves five characters unescaped (! ' ( ) *), a quirk left over from an older URI specification. This tool adds one extra pass to escape those too, giving fully strict percent-encoding - the more common expectation for a general-purpose "URL encode" tool.

Why did decoding fail with an error?

The text wasn't validly percent-encoded - usually a stray % not followed by two hex digits, or a truncated multi-byte sequence (common when encoded text gets cut off mid-copy). Fix the encoded text and it'll decode automatically.

What does the Swap button do?

It moves the current result into the input box and flips the operation, so you can immediately verify a round trip - encode something, hit Swap, and decoding it should give back exactly what you started with.

Can I encode a whole URL, not just one value?

This tool is built for encoding a single value (a query parameter, a path segment) with encodeURIComponent() - see "encodeURI() vs. encodeURIComponent()" above for why encoding an entire URL needs a different, less aggressive function that leaves the URL's own structural characters alone.

Is my text uploaded anywhere?

No - encoding and decoding both happen entirely in your browser; nothing is ever sent anywhere.

Related tools

Try the Base64 Encoder / Decoder, or browse the rest of the Developer tools on NeatSize.

Runs entirely in your browser - nothing you enter or upload is sent to a server.