Skip to content

πŸ”— URL Encoder / Decoder

Encode URLs for safe web transmission or decode percent-encoded URLs

0 characters
0 characters Copied!

URL Encoding and Decoding Made Simple

URL encoding (also called percent encoding) is essential for transmitting data safely over the Internet. When you include special characters, spaces, or non-ASCII characters in a URL, they must be encoded into a format that web browsers and servers can understand.

Our free online URL encoder/decoder handles all encoding tasks instantly in your browser. No server uploads, completely private, and supports UTF-8 encoding for international characters.

Common use cases: Encoding query parameters, building API URLs, debugging web applications, creating shareable links, handling form data, and working with internationalized URLs.

How to Use the URL Encoder/Decoder

Encoding a URL

  1. Paste your URL or text into the input field
  2. Select encoding type:
    • Component - Use for query parameter values (encodes all special characters)
    • URI - Use for complete URLs (preserves URL structure like :// and /)
  3. Click "Encode URL" - The result appears instantly below
  4. Copy the result using the copy button

Decoding a URL

  1. Switch to "Decode" mode using the dropdown
  2. Paste the encoded URL (with %20, %3A, etc.)
  3. Click "Decode URL" - Original text appears instantly
  4. Copy or swap to re-encode if needed

Quick Example

Original: https://example.com/search?q=hello world&lang=en

Encoded (Component): https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den

Encoded (URI): https://example.com/search?q=hello%20world&lang=en

Why Choose Our URL Encoder/Decoder?

πŸ”’ 100% Private and Secure

All encoding and decoding happens entirely in your browser using JavaScript. Your URLs never touch our servers, ensuring complete privacy. No data is collected, stored, or transmitted.

⚑ Real-Time Processing

Instant encoding and decoding with no page reloads. Process multiple URLs quickly with copy-paste workflow. Character counters update in real-time.

🌍 UTF-8 Support

Full support for international characters, emoji, and any Unicode character. Encode Chinese (δ½ ε₯½), Arabic (Ω…Ψ±Ψ­Ψ¨Ψ§), emoji (πŸ˜€), or any language correctly.

🎯 Smart Encoding Options

Choose between Component encoding (for query parameters, form values) and URI encoding (for complete URLs). Component encoding is more aggressive and encodes ALL special characters. URI encoding preserves URL structure.

πŸ”„ Swap Function

Quickly swap input and output to re-encode or decode the result. Perfect for testing round-trip encoding or converting back and forth.

πŸ“‹ One-Click Copy

Copy encoded or decoded URLs to your clipboard instantly with the copy button. Visual feedback confirms successful copy.

πŸ’» Developer-Friendly

Clear distinction between encodeURIComponent() and encodeURI() behavior. Perfect for developers debugging API calls, building URLs programmatically, or learning URL encoding standards (RFC 3986).

Frequently Asked Questions

What is URL encoding?

URL encoding (percent encoding) converts characters into a format that can be transmitted over the Internet. Special characters are replaced with '%' followed by two hexadecimal digits representing the character's UTF-8 byte code. For example, a space becomes %20, ampersand becomes %26, and forward slash becomes %2F.

When should I use URL encoding?

Use URL encoding when:

  • Passing data in query parameters (?name=value)
  • URLs contain spaces or special characters
  • Building API request URLs
  • Submitting form data via GET requests
  • Including non-ASCII characters (Chinese, Arabic, emoji) in URLs
  • Working with URL fragments or hash parameters
  • Creating shareable links with data

What's the difference between encodeURI and encodeURIComponent?

encodeURIComponent() (Component mode) encodes ALL special characters except - _ . ! ~ * ' ( ). Use this for encoding query parameter values. It encodes /:?#[]@ so it's not suitable for complete URLs.

encodeURI() (URI mode) encodes fewer characters and preserves URL structure characters like /:?#[]@. Use this for encoding complete URLs where you want to keep the URL readable and functional.

Rule of thumb: Use Component for query string values, use URI for complete URLs.

Is URL encoding the same as encryption?

No! URL encoding is NOT encryption or security. It's simply a way to represent characters safely in URLs. Anyone can decode a URL-encoded string instantly. Never put sensitive data (passwords, API keys, credit card numbers) in URLs, even when encoded. Always use HTTPS for secure transmission.

Can I URL encode non-English characters?

Yes! URL encoding supports UTF-8, so you can encode characters from any language and even emoji. Each UTF-8 byte is converted to percent notation. For example:

  • Chinese: δ½ ε₯½ β†’ %E4%BD%A0%E5%A5%BD
  • Arabic: Ω…Ψ±Ψ­Ψ¨Ψ§ β†’ %D9%85%D8%B1%D8%AD%D8%A8%D8%A7
  • Emoji: πŸ˜€ β†’ %F0%9F%98%80

Why does my URL have %20 instead of + for spaces?

Both are valid depending on context. %20 is the standard percent-encoding for spaces in URLs (RFC 3986). + is used in application/x-www-form-urlencoded data (HTML form submissions). Modern APIs and RESTful services typically use %20. Our tool uses standard %20 encoding.

What characters need to be URL encoded?

Reserved characters that have special meaning in URLs must be encoded:

  • : / ? # [ ] @ ! $ & ' ( ) * + , ; =

Additionally, encode:

  • Spaces
  • Non-ASCII characters (Γ©, Γ±, δΈ­, ζ—₯, emoji)
  • Control characters and unprintable characters
  • Percent sign (%) itself β†’ %25

Can I decode a partially encoded URL?

Yes! The decoder will decode any percent-encoded sequences it finds and leave non-encoded characters as-is. This is useful when working with mixed or partially encoded URLs.

Is this tool free to use?

Yes, completely free! No sign-up, no limits, no ads blocking the tool. Use it as much as you need for personal or commercial projects.

Does this work offline?

After the page loads initially, the tool works entirely in your browser using JavaScript. No internet connection is required for encoding/decoding operations.

URL Encoding Rules: Which Characters Get Percent-Encoded, and Why Bugs Happen

URL encoding replaces each unsafe byte with a percent sign and two hex digits, so a space becomes %20 and Γ© becomes %C3%A9. The rules come from RFC 3986, and the two JavaScript functions behind this tool, encodeURIComponent() and encodeURI(), apply them differently.

This section goes past the basics above. It lists exactly which characters each mode leaves alone, walks through the bugs that cost developers the most time, and shows how to build URLs without hand-encoding.

Which characters stay as they are

RFC 3986 sorts URL characters into three groups. Only the first group is always safe unencoded.

GroupCharactersMeaning
UnreservedA-Z a-z 0-9 - . _ ~Never need encoding
General delimiters: / ? # [ ] @Split a URL into scheme, host, path, query and fragment
Sub-delimiters! $ & ' ( ) * + , ; =Have special meaning in some parts, such as & and = in queries

The two modes in the tool differ on the second and third groups. We ran both on the same text to show it:

CharacterComponent modeURI mode
/ ? : @Encoded (%2F %3F %3A %40)Kept
# & = + , ; $EncodedKept
[ ]Encoded (%5B %5D)Encoded
! ' ( ) *KeptKept
Space, ", %EncodedEncoded

Because ! ' ( ) * are never encoded, RFC 3986 purists sometimes add a post-processing step for them. For ordinary query values this is not needed.

Worked examples with checked output

A search term with symbols (Component mode):

Input:  cafΓ© & tea/10%
Output: caf%C3%A9%20%26%20tea%2F10%25

The accented letter is two UTF-8 bytes, so it becomes two percent groups. The bare % had to become %25.

A URL passed as a parameter value (Component mode):

Input:  https://example.com/cb?x=1&y=2
Output: https%3A%2F%2Fexample.com%2Fcb%3Fx%3D1%26y%3D2

This is the form you need for ?redirect=... parameters. Without it, the inner &y=2 would be read as a second outer parameter.

JSON inside a query string:

Input:  {"a":1,"b":[1,2]}
Output: %7B%22a%22%3A1%2C%22b%22%3A%5B1%2C2%5D%7D

Format the JSON first with the JSON formatter to make sure it is valid before you encode it.

Bugs worth knowing about

Double encoding

Encoding an already-encoded string turns every % into %25. A space that was %20 becomes %2520, and the server sees the literal text %20. If a link works when you paste it but fails from your app, look for %25 in the URL. Encode raw values exactly once, as the last step before building the URL.

Plus signs are not decoded

decodeURIComponent("a+b%20c") returns a+b c. The plus sign survives because it only means "space" inside form-encoded data (application/x-www-form-urlencoded), as defined in the WHATWG URL standard. If your input came from an HTML form or a search engine URL, replace + with a space before decoding. The reverse also matters: a real plus sign in a value must be written %2B, or it turns into a space on the server.

"URI malformed" errors

Decoding fails with URIError: URI malformed in two common cases. One is a stray percent sign, as in 100%. The other is a truncated multi-byte sequence, such as %E4%BD, which is two of the three bytes of a Chinese character. When the tool shows "Invalid URL encoding", look for text that was cut off by a length limit or copied with a missing tail.

Unicode domain names

Percent-encoding is for paths and queries. Domain names use a different scheme, Punycode. Running URI mode on https://δΎ‹γˆ.jp/パス encodes the host too, giving https://%E4%BE%8B%E3%81%88.jp/..., which no DNS server will resolve. Encode only the path and query, and let the browser or the URL class convert the hostname.

Square brackets in query keys

URI mode encodes [ and ], so a[1]=2 becomes a%5B1%5D=2. Most frameworks decode this back to the same key, but some old parsers do not. It also means URI mode breaks IPv6 hosts like [::1].

Build URLs with code, not by hand

Hand-assembled strings are where most encoding bugs start. In JavaScript, URLSearchParams encodes each value correctly for you:

new URLSearchParams({ q: "a b&c", t: "x+y" }).toString()
// "q=a+b%26c&t=x%2By"

Note it writes spaces as +, the form-encoded style. That is valid in query strings. If a strict API demands %20, use encodeURIComponent() on each value and join with & yourself. Campaign links with many parameters are easier with the UTM builder, which handles this for you.

The MDN reference for encodeURIComponent also documents the lone-surrogate error: a broken emoji half throws instead of encoding.

Related encodings people confuse with this

  • HTML entities make text safe inside a page. See the HTML encoder. A URL placed in an href usually needs both: percent-encode first, then escape & as &.
  • Base64 turns bytes into text and is a different alphabet entirely. Standard Base64 uses + and /, which must themselves be percent-encoded in a URL unless you use the URL-safe variant. See the Base64 tool.

More questions

Why does my encoded URL contain %25?

That is an encoded percent sign. It usually means the string was encoded twice. Decode once with this tool; if you get readable text with %20 or similar still inside, the original was double-encoded.

Do I need to encode the path as well as the query?

Yes, each path segment needs encoding for spaces, ?, # and non-ASCII letters. Encode each segment on its own with Component mode, then join them with literal slashes. Encoding the whole path in Component mode would turn the slashes into %2F.

Are the hex digits case sensitive?

RFC 3986 says uppercase is preferred, so %C3%A9 rather than %c3%a9. Decoders accept both, but some signature schemes, such as request signing for cloud APIs, compare the exact string and require uppercase.

Why did the fragment after # disappear on my server?

Browsers never send the fragment to the server. If you meant a literal hash character inside a value, encode it as %23 so it stays in the query.

Is there a length limit for encoded URLs?

The standard sets none, but browsers, servers and proxies do. Staying under about 2,000 characters is a common safe target, and encoding makes strings longer: every non-ASCII letter costs six to twelve characters.