URL Encoder & Decoder

URL Encoder & Decoder

Encode URLs for safe transmission or decode them to view original content

0 characters
Full Encoding
URL Only
0 characters
Decoding Status
Ready to decode
Result
Your encoded/decoded result will appear here...
Ready for encoding or decoding
URL Encoding Information
What is URL Encoding?
URL encoding converts characters into a format that can be transmitted over the Internet. It replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.
Space → %20, & → %26, ? → %3F
Why Encode URLs?
Some characters have special meanings in URLs. Encoding ensures special characters like spaces, question marks, and ampersands are transmitted correctly without breaking the URL structure.
https://site.com?q=hello world → https://site.com?q=hello%20world
encodeURI vs encodeURIComponent
encodeURI: Encodes full URLs but preserves ://, /, ?, &, =
encodeURIComponent: Encodes everything including special characters
Choose based on your needs
Common Encoded Characters
Space: %20, &: %26, ?: %3F, =: %3D, #: %23, @: %40, /: %2F, :: %3A, %: %25
Most common: Space → %20
Quick Examples (Click to Load)

Creator & Maintainer

Image of Faiq Ur Rahman, CEO & Founder Toolraxy

Faiq Ur Rahman

Founder & CEO, Toolraxy

Faiq Ur Rahman is a web designer, digital product developer, and founder of Toolraxy, a growing platform of web-based calculators and utility tools. He specializes in building structured, user-friendly tools focused on health, finance, productivity, and everyday problem-solving.

Share:

Rate this Tool

User Ratings:

0.0
0.0 out of 5 stars (based on 0 reviews)
Excellent0%
Very good0%
Average0%
Poor0%
Terrible0%

ADVERTISEMENT

ADVERTISEMENT

What Is URL Encoder & Decoder?

URL Encoder & Decoder is a web utility that converts text into a format safe for URLs and reverses the process. When you include special characters like spaces, ampersands (&), or question marks (?) in a URL, they can break the link or cause errors. URL encoding replaces these characters with a percent sign (%) followed by two hexadecimal digits.

For example:

  • Space becomes %20

  • Ampersand (&) becomes %26

  • Question mark (?) becomes %3F

The tool provides two encoding methods and two decoding methods, giving you full control over how your URLs are processed.

 

Why This Tool Matters

URLs are the foundation of the web, yet they have strict character limitations. When you build dynamic URLs—whether for search queries, API calls, or campaign tracking—you inevitably encounter characters that aren’t URL-safe.

Without proper encoding:

  • Spaces break links into multiple parts

  • Ampersands get interpreted as parameter separators

  • Special characters like #, %, and @ cause parsing errors

  • Non-ASCII characters (é, ñ, 中文) display incorrectly or fail entirely

Manual encoding is error-prone and time-consuming. This tool handles it instantly, with clear visual feedback and both encoding standards at your fingertips.

 

How to Use This Tool

Step 1: Choose Your Tab

Click URL Encoder to convert plain text into percent-encoded format, or URL Decoder to convert encoded strings back to readable text.

 

Step 2: Enter Your Text

  • For encoding: Paste the text or URL you need to encode into the top textarea

  • For decoding: Paste the percent-encoded string into the decoder textarea

 

Step 3: Select Your Method

  • Full Encoding (encodeURIComponent): Use when encoding data for query string parameters. This encodes EVERYTHING except letters, numbers, and a few safe characters.

  • URL Encoding (encodeURI): Use when encoding a complete URL. This preserves protocol (http://), domain slashes, and query structure while encoding unsafe characters.

For decoding, match the method to how the string was encoded:

  • decodeURIComponent: Use for strings encoded with encodeURIComponent

  • decodeURI: Use for strings encoded with encodeURI

 

Step 4: Click Process

Press the Process button or use Ctrl+Enter (Cmd+Enter on Mac). Your result appears instantly in the result box.

 

Step 5: Copy or Download

Click Copy to save the result to your clipboard. Use Clear All to start over, or Swap to move encoded/decoded content between tabs.

 

How It Works

URL encoding replaces unsafe ASCII characters with a percent sign followed by two hexadecimal digits representing the character’s byte value.

The technical process:

  1. Character Analysis – The tool examines each character in your input string.

  2. Safe Character Preservation – Characters that are safe for URLs (A-Z, a-z, 0-9, and -_.!~*'()) remain unchanged when using encodeURIComponent.

  3. Unsafe Character Conversion – Unsafe characters are converted to their UTF-8 byte representation, then each byte is expressed as %XX where XX is the hexadecimal value.

  4. Method Differentiation:

    • encodeURIComponent encodes ALL unsafe characters, including /?&, and =

    • encodeURI encodes most characters but leaves :///?&#, and = intact to maintain URL structure

  5. Decoding – The process reverses: %20 becomes space, %3F becomes ?, etc. The tool validates each percent sequence and throws errors for malformed encoding.

 

Real-Life Example

Scenario: You’re building a search link for an e-commerce site that includes user-entered filters.

 

Your raw parameters:

  • Category: “Men’s Shoes”

  • Color: “Blue & Gray”

  • Price: “$50-$100”

  • Query: “size 10”

 

Raw URL attempt (breaks immediately):

text
https://store.com/search?cat=Men's Shoes&color=Blue & Gray&price=$50-$100&q=size 10

 

Problems:

  • Spaces break the URL

  • Apostrophe (‘) is unsafe

  • Ampersand (&) gets interpreted as a new parameter

  • Dollar sign ($) has special meaning

 

Using the URL Encoder:

  1. Paste the query string portion: Men's Shoes&Blue & Gray&$50-$100&size 10

  2. Select Full Encoding (encodeURIComponent)

  3. Click Process

Result:

Men%27s%20Shoes%26Blue%20%26%20Gray
%26%2450-%24100%26size%2010

 

Final working URL:

https://store.com/search?cat=Men%27s%20Shoes&color=
Blue%20%26%20Gray&price=%2450-%24100&q=size%2010

The URL now transmits safely, and the server correctly receives each parameter.

 

Benefits

  • Dual Encoding Methods – Choose between encodeURI and encodeURIComponent based on your specific need

  • Instant Results – No page reloads, no waiting

  • Character Counter – Know exactly how long your strings are

  • Swap Function – Move between encoder and decoder with one click

  • Keyboard Shortcuts – Ctrl+Enter to process, Ctrl+E for examples

  • Error Detection – Invalid percent-encoding is caught and explained

  • Validation Feedback – Know whether your decoded result looks like a valid URL

  • Free & Private – No server storage, all processing happens in your browser

 

Who Should Use This Tool

User TypeHow They Benefit
Web DevelopersEncode API parameters, build dynamic URLs
SEO SpecialistsCreate trackable campaign URLs with correct encoding
Digital MarketersEnsure UTM parameters pass through analytics platforms
QA TestersValidate URL handling in web applications
Content ManagersInclude special characters in links
API IntegratorsPrepare data for POST requests and query strings
StudentsLearn URL encoding through hands-on examples

 

Common Mistakes to Avoid

1. Using the Wrong Encoding Method

  • Mistake: Using encodeURI on query string parameters

  • Result: Slashes, ampersands, and equals signs remain unencoded, breaking parameter boundaries

  • Fix: Use encodeURIComponent for parameter values

 

2. Double-Encoding

  • Mistake: Encoding an already encoded string

  • Result: %20 becomes %2520, causing server-side decoding errors

  • Fix: Only encode raw, unencoded text

 

3. Forgetting to Decode Before Display

  • Mistake: Showing %20 to users instead of spaces

  • Result: Poor user experience

  • Fix: Always decode for human-readable display

 

4. Mixing decodeURI and decodeURIComponent

  • Mistake: Using decodeURI on encodeURIComponent output

  • Result: May work partially but fails on encoded slashes and other characters

  • Fix: Match the decoding method to the encoding method

 

5. Ignoring Character Limits

  • Mistake: Encoding extremely long strings (>2000 characters)

  • Result: Some browsers/servers have URL length limits

  • Fix: Use POST requests for very long data

 

Limitations

  • No automatic detection – The tool doesn’t know which encoding method was used on a given string; you must select the correct decoder

  • Browser-based only – All processing happens client-side; very large inputs (>10,000 chars) may cause performance lag

  • No batch processing – Each string must be processed individually

  • Unicode handling – Characters outside the Basic Multilingual Plane encode to surrogate pairs, which may behave unexpectedly

  • No URL validation – The tool encodes/decodes any text but doesn’t verify it’s a valid URL

Percent-Encoding Explained

Percent-encoding, also known as URL encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). Certain characters are reserved in the URI syntax and must be escaped when used for other purposes. The encoding replaces each unsafe character with a percent sign (%) followed by two hexadecimal digits representing the character’s ASCII code (or UTF-8 byte for non-ASCII).

For example, the forward slash (/) is reserved for separating path segments. If you need a slash as data—like in a filename—it must be encoded as %2F. Without encoding, the browser interprets it as a path separator, breaking your URL structure.

 

encodeURI vs encodeURIComponent: When to Use Each

Use encodeURI when:

  • You have a complete URL with protocol, domain, and path

  • You need to preserve the URL structure (slashes, query separators)

  • Example: encodeURI

(“https://example.com/path with spaces/page.html”)

 

Use encodeURIComponent when:

  • You’re building query string parameters

  • You’re encoding data that will become part of a URL parameter

  • You need maximum encoding safety

  • Example: encodeURIComponent("user input with & special chars!")

Mixing these up is the most common URL encoding mistake. Remember: encodeURI for the URL skeleton, encodeURIComponent for the stuffing.

 

URL Structure and Reserved Characters

RFC 3986 defines the standard URI syntax and reserves several characters for specific purposes:

  • :/?#[]@ – General delimiters

  • !$&'()*+,;= – Sub-delimiters

When these characters appear in data—not as delimiters—they must be percent-encoded. The ampersand (&) separates query parameters, so if your parameter value contains an ampersand, it must become %26. The equals sign (=) separates parameter names from values, so data containing equals becomes %3D.

 

Common URL Encoding Pitfalls

The space encoding confusion: Spaces can be encoded as %20 (standard) or + (in application/x-www-form-urlencoded forms). Modern practice prefers %20 for consistency.

The hash problem: The hash (#) marks the fragment identifier. If your data contains #, encode it as %23 or the browser will treat everything after it as an anchor link.

The percent sign dilemma: If your data already contains percent signs (e.g., 100% satisfaction), encoding must handle it carefully. The percent sign itself encodes to %25, so “100% satisfaction” becomes “100%25 satisfaction” after encoding.

 

URL Encoding in Different Programming Languages

Understanding how other languages handle URL encoding helps when debugging cross-platform issues:

  • JavaScript: 

encodeURI()encodeURIComponent()decodeURI()decodeURIComponent()


  • PHP:

 urlencode() (similar to encodeURIComponent), rawurlencode() (RFC 3986 compliant)

  • Python:

 urllib.parse.quote() and urllib.parse.quote_plus()

  • C#: 

Uri.EscapeDataString() and Uri.EscapeUriString()

 

Each language has slight variations, but the percent-encoding principle remains consistent across platforms.

 

Query Strings and Form Data

When HTML forms submit using GET method, the browser automatically encodes form data using application/x-www-form-urlencoded encoding. This is similar to encodeURIComponent but uses + for spaces (legacy behavior). Modern applications increasingly use %20 for consistency with URL standards.

Understanding this distinction is crucial when manually building form submissions or parsing server logs.

Faqs

What's the difference between encodeURI and encodeURIComponent?

encodeURI is used for encoding complete URLs. It preserves characters that have special meaning in URLs (like :///?&=). encodeURIComponent is used for encoding individual parameter values. It encodes all special characters, including slashes and ampersands, ensuring they’re treated as data rather than URL structure.

Spaces in URLs should be encoded as %20. Our tool does this automatically when you use either encoding method. For example, “hello world” becomes “hello%20world”.

If you see % symbols after decoding, the string may have been double-encoded, or you’re using the wrong decoding method. Try the other decoding option. If the problem persists, the original string may contain % characters that aren’t part of percent encoding.

Yes. URL encoding supports Unicode characters. Characters like “café” encode to “caf%C3%A9”. The tool handles UTF-8 encoding automatically.

The following characters are safe and don’t require encoding: A-Z a-z 0-9 - _ . ~ ! * ' ( ). All other characters should be encoded when appearing in URLs.

Encoded strings contain percent signs followed by two hexadecimal digits (0-9, A-F). For example, %20 indicates an encoded space. However, this isn’t foolproof—some legitimate text contains percent signs. When in doubt, try decoding; if the result looks readable, it was encoded.

URL length limits vary by browser and server. Internet Explorer limits URLs to 2,048 characters. Most modern browsers support up to 8,000 characters. For very long data, use POST requests instead of GET.

decodeURI reverses encodeURI—it leaves URL structure intact. decodeURIComponent reverses encodeURIComponent and decodes absolutely everything. Using the wrong method can leave some characters encoded or cause errors.

ADVERTISEMENT

ADVERTISEMENT