URL Encoder & Decoder

Percent-encode and decode URL strings or query parameters with the correct JavaScript semantics.

About URL encoding

URL encoding (also called percent encoding) replaces unsafe characters in a URL with a % followed by two hex digits, so they survive transport through systems that reserve characters like ?, &, =, and / for special purposes.

encodeURI vs encodeURIComponent

JavaScript exposes two encoders:

  • encodeURIComponent() escapes everything that is not unreserved, including :/?#[]@!$&'()*+,;=. Use this for individual query-parameter values.
  • encodeURI() preserves the reserved characters that make a URL a URL. Use this when you have an entire URL string and want to encode only the parts that need escaping (like spaces or non-ASCII characters).

Privacy

All encoding and decoding happens inside your browser using the built-in encodeURI, encodeURIComponent, decodeURI, and decodeURIComponent functions. Nothing is sent to a server.

Frequently asked questions

Which encoder should I use for query string values?
Use encodeURIComponent. It escapes &, =, and other characters that would otherwise terminate the value.
My URL has Unicode characters like ö or 中. Does this tool handle them?
Yes. Unicode characters are encoded into UTF-8 bytes and then percent-escaped, which is what the WHATWG URL Standard requires.
How do I encode a whole URL?
Switch to encodeURI mode. This preserves the structural characters (the colon after the scheme, slashes in the path, the question mark, and so on) while escaping anything illegal.
What is the difference between URL encoding and Base64?
They solve different problems. Base64 turns arbitrary bytes into ASCII text. URL encoding makes a string safe to put inside a URL by escaping reserved characters.