Skip to main content
Developer, Web & Image Tools

URL Encode / Decode

Percent-encode special characters for safe URL transmission and decode encoded URI query strings.

What is the URL Encode / Decode?

The URL Encode / Decode tool converts reserved, non-ASCII, and unsafe characters into their percent-encoded equivalents (e.g. spaces → %20 or +) for web browser navigation and REST query strings, and translates percent-encoded strings back into readable text. It supports both full URL encoding (encodeURI) and component parameter encoding (encodeURIComponent).

Uniform Resource Identifiers (URIs) only permit a restricted subset of US-ASCII characters. Passing spaces, ampersands, question marks, hashes, or non-Latin characters directly inside URL query parameters causes server parsing ambiguities, broken links, and security vulnerabilities.

How to Use the URL Encode / Decode

  1. Select Mode: Choose Encode to make text URL-safe, or Decode to convert percent codes back to text.
  2. Choose Scope: Select Component Mode (for query parameter values) or Full URL Mode (preserving protocol and domain slashes).
  3. Input String: Type or paste your URL or query parameter.
  4. Copy Output: Copy the safe percent-encoded string for use in your API call or link.

Formula & How It Works

Percent-encoding maps unsafe characters into a '%' followed by their two-digit hexadecimal byte value:

Standard Mapping:
Space (' ') → %20 (or '+' in query strings)
Ampersand ('&') → %26
Question Mark ('?') → %3F
Slash ('/') → %2F
Hash ('#') → %23
Equals ('=') → %3D

JavaScript Functions:
encodeURIComponent(str): Encodes all reserved punctuation characters.
encodeURI(str): Preserves protocol slashes and domain colons.
decodeURIComponent(str): Decodes all percent sequences.

Worked Example: Query string value: name=John & Doe?. Encoded via encodeURIComponent: name%3DJohn%20%26%20Doe%3F.

Practical Worked Examples

Original Character / StringPercent-EncodedReason for Encoding
Space (" ")%20Spaces are illegal in raw URLs
"&" (Ampersand)%26Prevents splitting into unintended query params
"https://example.com/search?q=cat & dog"https://example.com/search?q=cat%20%26%20dogMaintains URL structural integrity

Common Everyday & Professional Use Cases

Constructing webhook redirect callback URLs, passing parameters in OAuth authorization requests, formatting social share buttons, and debugging server access logs.

Frequently Asked Questions about URL Encode / Decode

encodeURI preserves characters with special structural meaning in a URL (such as http://, slashes, and question marks). encodeURIComponent aggressively encodes everything except letters and digits, making it ideal for parameter values.
Under older application/x-www-form-urlencoded MIME standards (such as HTML form POST submissions), spaces were encoded as '+'. Standard RFC 3986 URI encoding specifies '%20'.
Yes. Each unicode character is converted into its constituent UTF-8 bytes, and each byte is percent-encoded (e.g. 'é' becomes '%C3%A9').
No, all encoding and decoding runs client-side inside your browser sandbox.
If a URL was only encoded once, decoding it a second time produces identical output unless it contained literal '%' characters.
Explore More

Related Free Online Tools

All Developer, Web & Image Tools →

JSON Formatter & Validator

Format, beautify, minify, and validate JSON data structures with clear syntax error indicators.

Base64 Encode / Decode

Encode text and binary strings into Base64 ASCII format and decode Base64 strings back to plain text.

Hash Generator

Generate cryptographic hashes including MD5, SHA-1, SHA-256, and SHA-512 simultaneously from any text input.

Password Generator

Generate strong, cryptographically secure, randomized passwords with customizable length and symbol rules 100% client-side.

Helpful Guides & Mathematical Tutorials