๐Ÿ”—

URL Encoder & Decoder

Encode special characters or decode percent-encoded URLs instantly.

โš™๏ธ Encoding Options
๐Ÿ“ Text to Encode
Quick insert:
โœ… Encoded Result

๐Ÿ“– Complete Guide to URL Encoding

URL encoding, also known as percent-encoding, is a fundamental mechanism for safely transmitting data within URLs. Since URLs can only contain a limited subset of ASCII characters, any special characters, spaces, or non-English text must be converted into a format that web servers and browsers can understand. This tool handles both encoding (converting characters to their percent-encoded form) and decoding (converting back to readable text).

Understanding URL encoding is essential for web developers, API integrators, SEO specialists, and anyone who works with web addresses. Incorrectly encoded URLs can lead to broken links, failed API requests, and security vulnerabilities. This encoder/decoder makes the process simple and error-free.

How URL Encoding Works

When a character needs to be encoded, it's converted to its UTF-8 byte representation, and each byte is written as a percent sign followed by two hexadecimal digits. For example, a space character (ASCII 32) becomes %20, and the Euro sign โ‚ฌ becomes %E2%82%AC (three bytes in UTF-8).

Character Encoded Form ASCII/Unicode Value Common Use
(space) %20 or + 32 Separating words in search queries
! %21 33 Exclamation in text
# %23 35 Fragment identifiers, hashtags
$ %24 36 Currency in prices
% %25 37 Literal percent signs
& %26 38 Parameter separators
+ %2B 43 Math expressions, phone numbers
/ %2F 47 Path components with slashes
= %3D 61 Values containing equals signs
? %3F 63 Literal question marks in values
@ %40 64 Email addresses, usernames

Characters That Don't Need Encoding

Not every character requires encoding. The following "unreserved" characters are safe to use directly in URLs:

  • Uppercase letters: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  • Lowercase letters: a b c d e f g h i j k l m n o p q r s t u v w x y z
  • Digits: 0 1 2 3 4 5 6 7 8 9
  • Special unreserved: - (hyphen), _ (underscore), . (period), ~ (tilde)

When to Use URL Encoding

  • Query Parameters: When passing user input or data through URL parameters like ?search=hello%20world
  • API Requests: When building RESTful API endpoints with dynamic data in the path or query string
  • Form Submissions: GET method forms automatically encode data, but understanding the process helps with debugging
  • Special Characters: Whenever your URL contains spaces, symbols, or non-ASCII characters like accents or emojis
  • Redirects: When creating redirect URLs that contain other URLs as parameters
  • Tracking Links: Marketing URLs often contain encoded parameters for analytics

Encoding Options Explained

Option What It Does When to Use
Encode Spaces Converts spaces to %20 Standard URL encoding for most cases
Space as + (Form) Converts spaces to + instead of %20 HTML form submissions (application/x-www-form-urlencoded)
Encode All Characters Encodes everything except letters and numbers Maximum compatibility or when unsure what's safe

๐Ÿ’ก Pro Tip: In JavaScript, use encodeURIComponent() for encoding query parameter values, and encodeURI() for encoding complete URLs while preserving the URL structure (protocol, slashes, etc.). Never use escape() as it's deprecated and doesn't handle Unicode properly.

Common Encoding Mistakes to Avoid

  • Double encoding: Encoding a URL that's already encoded turns %20 into %2520, breaking the link
  • Not encoding special characters: Unencoded & or = in parameter values will corrupt your query string
  • Encoding the entire URL: Protocol (https://) and path separators (/) should usually not be encoded
  • Forgetting to encode +: In query strings, + means space, so literal + must be encoded as %2B
  • Platform differences: Some systems use different encoding conventions, always test thoroughly

โ“ Frequently Asked Questions

URL encoding (percent-encoding) converts characters that are not allowed in URLs into a safe format. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20, and an ampersand (&) becomes %26. This ensures URLs work correctly across all browsers and servers.

Both represent spaces, but in different contexts. %20 is the standard URL encoding for spaces and works everywhereโ€”in paths, query strings, and fragments. The + sign is specifically used in the query string portion of URLs, following the application/x-www-form-urlencoded format used by HTML forms. When decoding, + is only interpreted as a space in query strings, not in paths. For maximum compatibility, %20 is the safer choice.

URLs can only contain a limited set of ASCII characters (letters, numbers, and a few special characters). Characters like spaces, &, =, ?, #, and all non-English characters must be encoded to be properly transmitted and interpreted. Without encoding, these characters could be misinterpretedโ€”for example, an unencoded & would be seen as a parameter separator rather than part of your data.

No, they serve different purposes. URL encoding (percent-encoding) converts individual problematic characters to their hex representation with a % prefixโ€”the result is still mostly readable. Base64 encoding converts binary data to ASCII text using a 64-character alphabetโ€”the entire input becomes an unreadable string of letters, numbers, and +/= characters. Use URL encoding for URLs; use Base64 for embedding binary data in text formats.

Unreserved characters that are safe to use directly in URLs include: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), hyphen (-), underscore (_), period (.), and tilde (~). All other characters should be encoded for maximum compatibility. Reserved characters like /, ?, &, and = have special meanings in URLs, so they need encoding when used as data rather than as URL structure.

Non-English characters (like รฉ, รฑ, ไธญๆ–‡, or emoji ๐ŸŽ‰) are first converted to their UTF-8 byte sequence, then each byte is percent-encoded. For example, the character "รฉ" (U+00E9) becomes %C3%A9 (two UTF-8 bytes). This tool handles all Unicode characters automaticallyโ€”just paste your text and it will be correctly encoded for use in URLs.

๐Ÿ“ข

Why Ads?

Ads help keep DC Tools free and running. Thank you for your support!

๐Ÿ›

Found a Bug?

Help us improve! Report issues and suggestions.

Report Bug