URL Encode/Decode
Encode or decode URLs and query strings.
What Is URL Encoding?
URL encoding, also known as percent-encoding, is a method of representing special characters in a URL using a percent sign (%) followed by two hexadecimal digits. For example, a space character becomes %20, and an ampersand (&) becomes %26. This encoding ensures that URLs remain valid and unambiguous, because many characters have special meaning in URL syntax — such as ? for query strings, # for fragment identifiers, and & for separating parameters.
When Do You Need URL Encoding?
Any time you include user input, file names, or arbitrary text in a URL, those values should be percent-encoded. Common scenarios include building API query strings, constructing redirect URLs, encoding form data for GET requests, and embedding text in links shared via email or messaging platforms. Without proper encoding, characters like spaces, quotes, or Unicode symbols can break the URL or cause unexpected behavior on the receiving server.
encodeURI vs. encodeURIComponent
JavaScript provides two built-in functions for URL encoding. encodeURIComponent() encodes almost every special character except letters, digits, and a handful of unreserved marks (- _ . ~ ! ' ( ) *). It is the correct choice for encoding individual query parameter values or path segments. encodeURI() is less aggressive — it preserves characters that have structural meaning in a full URL, such as :, /, ?, #, and &. Use encodeURI() when you want to encode a complete URL without breaking its structure.
About This Tool
This tool runs entirely in your browser. Paste text or a URL, choose whether to encode or decode, and select whether to treat the input as a full URL or a single component. The result updates in real time. Your data never leaves your device.