Web & SEO

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.

Result

How It Works

  1. Choose encode or decode
  2. Enter your text
  3. Copy the result
Advertisement
728x90 — AdSense Leaderboard

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.

Frequently Asked Questions

What is URL encoding?
URL encoding (also called percent-encoding) replaces unsafe or reserved characters in a URL with a percent sign followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26. This ensures the URL is transmitted correctly across the internet.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL but preserves characters like : / ? # & = that have special meaning in URLs. encodeURIComponent encodes everything except letters, digits, and - _ . ~ making it ideal for encoding query parameter values. This tool uses encodeURIComponent for maximum safety.
Which characters are encoded by encodeURIComponent?
encodeURIComponent encodes all characters except A-Z, a-z, 0-9, and the four special characters - _ . ~ (tilde). Everything else, including spaces, punctuation, and non-ASCII characters, is percent-encoded.
When should I URL-encode a string?
You should URL-encode any string that will be used as a query parameter value, form data, or path segment in a URL. This prevents characters like &, =, and spaces from breaking the URL structure. It is especially important when building API requests or handling user-generated content in URLs.

Comments

Advertisement
728x90 — AdSense Leaderboard