ByteCompress

URL Encoder

Percent-encode special characters in URLs or individual URI components so they are safe to transmit in HTTP requests, query strings, and form data. Follows RFC 3986.

0 chars
FreeClient-sideNo signup

A space character in a URL query string silently breaks the request. RFC 3986 (Uniform Resource Identifier: Generic Syntax) defines which characters are safe in a URL and which must be percent-encoded. Percent-encoding replaces each unsafe byte with % followed by two uppercase hexadecimal digits. This browser-based encoder applies RFC 3986 instantly, without transmitting your data anywhere. Use it to encode full URLs or individual query parameter values and get standards-compliant output every time.

How to Encode a URL

  1. Paste the URL or text into the input field.
  2. Choose Full URL mode to encode only unsafe characters, or Component mode to encode all special characters including & and =.
  3. The percent-encoded output appears in the result panel.
  4. Copy the encoded string for use in your request, code, or documentation.

Understanding Percent-Encoding

The RFC 3986 Standard

RFC 3986 (IETF, 2005) defines two character categories in a URI. Unreserved characters (A-Z a-z 0-9 - _ . ~) can appear without encoding. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have special structural meaning and may or may not need encoding depending on context. Every other character β€” including spaces, non-ASCII Unicode, and characters outside these sets β€” must be percent-encoded.

encodeURI vs encodeURIComponent

JavaScript provides two encoding functions. encodeURI() encodes a complete URL and leaves reserved characters intact because they serve structural roles. encodeURIComponent() encodes structural characters too, treating them as literal data β€” it is designed for individual query parameter names and values where & and = would break URL syntax. This tool's Full URL mode corresponds to encodeURI; Component mode corresponds to encodeURIComponent.

Example

Input

Hello World! @2024

Output (Component mode)

Hello%20World!%20%402024

Space encodes as %20 (RFC 3986 standard); @ becomes %40. The exclamation mark is an unreserved character in some contexts and may or may not be encoded depending on mode.

Common Use Cases

  • Query parameter values β€” Encode values containing &, =, or + before appending to a URL
  • Search engine queries β€” Encode user search input before building a redirect URL
  • API request construction β€” Encode path segments containing slashes, spaces, or special characters
  • OAuth parameters β€” OAuth 1.0 signature base strings require percent-encoding per RFC 5849

Common Mistakes

  • Double-encoding β€” If a value is already percent-encoded, encoding it again encodes the % itself, producing %2520 instead of %20
  • Using Full URL mode for parameter values β€” Full URL mode leaves & and = unencoded, breaking query string syntax; use Component mode for parameter values
  • Forgetting non-ASCII characters β€” Non-ASCII text must be converted to UTF-8 bytes first, then each byte percent-encoded separately

To reverse the process, use the URL Decoder. For binary data transported in URL query parameters, first encode with the Base64 Encoder in URL-safe mode, then the output is already URL-safe without additional percent-encoding.

Frequently Asked Questions

What is the difference between URL encoding and Base64 encoding?

Percent-encoding replaces unsafe characters with %XX hex sequences while keeping safe characters as-is, so output length is similar to input. Base64 converts all data into a 64-character alphabet, increasing size by 33% but ensuring the result contains only safe ASCII characters. Percent-encoding makes specific characters URL-safe; Base64 encodes arbitrary binary data as text.

When should I use encodeURI vs encodeURIComponent in JavaScript?
encodeURI() is for encoding a complete URL β€” it preserves structural characters like : / ? # & =. encodeURIComponent() is for encoding individual values inside a URL β€” it encodes structural characters so they are treated as literal data rather than URL syntax. When in doubt, use encodeURIComponent() for any user-supplied input.
Why does a space become %20 in some encoders but + in others?
%20 is the RFC 3986 percent-encoding for a space and is correct for URI path segments and query values. The + sign representing a space is specific to application/x-www-form-urlencoded (HTML form submissions), which predates RFC 3986. Both are valid in their respective contexts, but %20 is the universal standard outside HTML forms.
Does URL encoding work for non-ASCII characters?

Yes. Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded separately. The character ş (U+015F) becomes %C5%9F. The Chinese character 中 (U+4E2D) becomes %E4%B8%AD. Modern browsers and servers all expect UTF-8 encoding for non-ASCII characters in URLs.

Is my URL data sent to your servers when I use this tool?

No. All encoding uses encodeURI() or encodeURIComponent() running locally in your browser. URLs, query parameters, authentication tokens, and any other data you paste are never transmitted to our servers.