URL Encoder Decoder — Free 2026
Encode or decode URL strings instantly using encodeURIComponent. Paste your text and get a URL-safe result in one click.
How It Works
- Choose encode or decode
- Enter your text
- Copy the result
Understanding URL Encoding
URL encoding, formally known as percent-encoding, is a mechanism defined in RFC 3986 for representing characters in a Uniform Resource Identifier (URI) that would otherwise be unsafe or ambiguous. When you type a web address into your browser, the URL must follow strict formatting rules. Characters like spaces, ampersands, question marks, and non-ASCII symbols cannot appear as-is in a URL — they must be replaced with a percent sign followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20, a forward slash becomes %2F, and the Japanese character "a" becomes a multi-byte sequence like %E3%81%82.
When and Why to Encode URLs
URL encoding is essential whenever you pass user-generated content as part of a URL. If you are building a search query string like ?q=hello world&lang=en, the space in "hello world" and the ampersand separating parameters must be encoded to prevent the browser from misinterpreting the URL structure. Without encoding, the server might receive broken or truncated parameter values. This is especially critical in API development, form submissions, redirect URLs, and analytics tracking parameters. Our slug generator can help create URL-friendly strings from titles, while this tool handles general-purpose encoding and decoding.
encodeURIComponent vs encodeURI
JavaScript provides two built-in functions for URL encoding. encodeURI() is designed for encoding a complete URL — it preserves characters that have structural meaning in URLs, including :, /, ?, #, &, and =. In contrast, encodeURIComponent() encodes everything except unreserved characters (letters, digits, hyphens, underscores, periods, and tildes). This tool uses encodeURIComponent() because it is the safer choice for encoding individual parameter values, path segments, and fragments. If you need to encode a full URL while keeping its structure intact, use encodeURI() instead.
Common Characters and Their Encoded Forms
Some of the most frequently encoded characters include: space (%20), exclamation mark (%21), hash (%23), dollar sign (%24), ampersand (%26), plus sign (%2B), equals sign (%3D), and at sign (%40). When decoding, the process is reversed — each %XX sequence is converted back to its original character. If you work with other text transformations, our character counter can help analyze the length and composition of your strings.
Comments