Calculateus

URL Encoder/Decoder

Encode special characters in a URL or decode a percent-encoded URL back to readable text.

Result

Result
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world

About the URL Encoder

This tool converts text or full URLs into percent-encoded format for safe use in web addresses, or reverses a percent-encoded string back into readable text. It is aimed at developers, marketers building tracking links, and anyone who needs to safely pass special characters through a URL.

How It Works

Type or paste text or a URL and choose encode or decode mode. In encode mode, the calculator runs the input through standard URI component encoding, converting spaces, symbols, and non-ASCII characters into percent-escaped sequences. In decode mode, it reverses percent-escaped sequences back into their original characters. If the decode input contains malformed percent-encoding, the calculator returns an error rather than a garbled result.

encode: result = encodeURIComponent(text); decode: result = decodeURIComponent(text)

Formula & Methodology

Encoding works by scanning the input character by character and replacing any character outside the safe URL character set (letters, digits, and a small set of punctuation marks) with a percent sign followed by its two-digit hexadecimal code, for example a space becomes %20. Decoding reverses this by finding each percent sign followed by two hex digits and converting that triplet back into the original character.

Examples

Encoding a search query

Encoding the text 'https://example.com/search?q=hello world' converts the space in 'hello world' to %20 and also encodes the colon, slashes, and question mark, since the entire string is treated as one component.

Decoding a percent-encoded string

Decoding 'hello%20world%21' converts %20 back to a space and %21 back to an exclamation mark, returning the readable text 'hello world!'.

Advantages

  • Handles both directions in one interface, so the same tool encodes plain text and decodes percent-encoded strings
  • Uses the same standard encoding function browsers and web frameworks rely on, so results match what real applications produce
  • Catches malformed decode input with a clear error instead of silently returning broken or partial text

Common Mistakes

  • Encoding an entire URL as a single component when only a query parameter value needed encoding, which unintentionally escapes the slashes and colons that should stay intact
  • Assuming encoding is a form of security or obfuscation, when it is only a compatibility format for embedding special characters and non-ASCII text in a URL
  • Attempting to decode text that was never percent-encoded, which usually just returns the original text unchanged but can error out if it happens to contain a stray percent sign

Edge Cases to Watch For

  • Decoding a string with an incomplete or malformed percent sequence, such as a lone percent sign not followed by two valid hex digits, triggers an error rather than a partial or corrupted decode
  • Encoding is applied to the entire input as one component, so a full URL with a protocol and slashes will have its slashes and colons encoded too, which is appropriate for a query parameter value but not for encoding a whole URL meant to remain clickable
  • Characters already considered URL-safe, such as letters, digits, and a handful of punctuation marks, pass through encoding unchanged

Common Use Cases

  • Developers testing how query parameters or special characters should appear in a URL
  • Marketers building or troubleshooting campaign links that include spaces, ampersands, or other special characters
  • Anyone decoding a long, encoded URL from an email or browser address bar back into readable text
Written & fact-checked by the Calculateus TeamLast updated August 5, 2026How we verify our formulas

Frequently asked questions

Why do URLs need to be encoded at all?

URLs can only safely contain a limited set of ASCII characters - spaces, special symbols, and non-Latin characters have to be converted to a percent-encoded format (like %20 for a space) so they don't get misinterpreted as part of the URL's structure (such as a query string separator) by browsers and servers.

Conclusion

This encoder and decoder mirrors the standard percent-encoding used across the web, making it a reliable way to prepare special characters for a URL or make an encoded link readable again. Because it encodes the whole input as a single component, apply it to individual parameter values rather than a complete URL when you want the structural characters like slashes to remain untouched.