Converters

URL Encoder and Decoder


Encode text to URL-safe format and decode percent-encoded strings instantly. Free tool for building safe query strings, API requests, and URLs.

0 characters
๐Ÿ’ก Tip: Press Ctrl+Enter to convert

๐Ÿ’ก About URL Encoding

  • URL encoding converts special characters to percent-encoded format (%XX)
  • Required for passing data in URLs, especially spaces and special characters
  • Spaces become %20, & becomes %26, = becomes %3D, etc.
  • Decoding reverses the process to get the original text
  • Essential for web development, API calls, and query parameters

URL Encoder and Decoder: The Essential Tool for Safe, Valid Web Addresses

URLs are picky. They accept only a narrow set of characters โ€” letters, digits, and a few specific symbols. Everything else needs translation. That's where URL encoding comes in, and why you need a reliable way to both encode and decode URLs on demand.

What URL Encoding Actually Is

URL encoding, technically called percent-encoding, converts characters that can't safely appear in a URL into a special format. The method is straightforward: replace the problematic character with a percent sign followed by its two-digit hexadecimal code.

A space transforms into %20. An ampersand becomes %26. The @ symbol turns into %40. Characters outside standard ASCII โ€” think Chinese characters, Arabic script, or emoji โ€” get encoded as their UTF-8 byte sequences, with each byte individually percent-encoded. The result looks cryptic to humans but makes perfect sense to browsers and servers.

Why URLs Demand Encoding in the First Place

RFC 3986 defines strict syntax rules for URLs. These rules categorize characters into three groups: unreserved characters that work as-is, reserved characters with special structural meaning, and everything else that must be encoded. When an unsafe or reserved character appears without proper encoding, it either breaks the URL or gets misinterpreted.

Consider an unencoded ampersand in a query parameter. The browser sees & and assumes it's a parameter separator, not part of the actual value. Your single parameter splits into two broken ones. Encoding it as %26 eliminates the ambiguity โ€” the browser knows it's literal data, not syntax.

The same logic applies to spaces, question marks, hash symbols, brackets, and non-ASCII characters. Each has either a reserved function or falls outside the permitted character set. Encoding protects your data.

How to Use a URL Encoder and Decoder

The process couldn't be simpler, regardless of which direction you're working. Most tools operate identically, including the one you need right now.

Encoding Text for URL Safety

Enter or paste your text into the input field. Click the Encode button. The tool converts your text into percent-encoded format, safe for URL insertion. Copy the result and use it wherever you need a valid URL component.

Decoding URLs Back to Readable Text

Paste a percent-encoded string into the input field. Click Decode. The tool translates those cryptic percent sequences back into human-readable text. Copy and analyze the decoded output.

No installation required. No complex settings. Just paste, click, copy.

When You Actually Need URL Encoding

URL encoding isn't academic theory. It solves real, recurring problems that developers and digital marketers face daily.

Building Query Strings Programmatically

When you construct URLs through code or formulas, parameter values often contain spaces, special characters, or Unicode text. Without encoding, these characters corrupt the URL structure. Encoding them first ensures the URL works correctly every time, particularly when working with HTML entity conversion and other text processing tasks.

Crafting API Requests

APIs frequently require URL-encoded parameters in request strings. Many APIs reject improperly encoded requests outright or, worse, silently misinterpret the data. Encoding parameter values before appending them prevents malformed requests and mysterious API errors.

Debugging Form Submissions

HTML form submissions use URL encoding for form data in GET requests. When form data doesn't arrive as expected, understanding encoding helps identify whether the problem lies in character handling. Combine this with HTML encoding tools when debugging forms that mix URL and HTML contexts.

Decoding Server Logs and Analytics

Server access logs and analytics platforms display URLs in encoded form. That's how they arrive, and that's how they're stored. Decoding these URLs reveals what users actually saw and typed, making analysis possible. When you're extracting URLs from sitemaps, you'll frequently encounter encoded URLs that need decoding for readability.

Handling International URLs

URLs containing Arabic, Chinese, Devanagari, Cyrillic, or other non-Latin scripts appear as long sequences of percent-encoded bytes. Decoding reveals the original text, making internationalized URLs manageable. This becomes especially important when extracting URLs from larger text blocks where encoded international characters can obscure the actual destination.

The Space Character Mystery: %20 vs. +

Two conventions exist for encoding spaces in URLs, and they're not interchangeable. This confuses people regularly.

%20 is the standard percent-encoding defined in RFC 3986. It works correctly everywhere โ€” URL paths, query strings, fragments, anywhere a space might appear.

+ is an alternative encoding used specifically in HTML form data following the application/x-www-form-urlencoded format. It works in query strings when the server expects form-encoded data. It doesn't work reliably in URL path components, where most servers interpret a literal plus sign instead of decoding it as a space.

When you're unsure which context you're working in, use %20. It's universally correct.

Understanding Reserved vs. Unreserved Characters

The distinction between reserved and unreserved characters determines what needs encoding and when. Unreserved characters โ€” A-Z, a-z, 0-9, hyphen, period, underscore, and tilde โ€” never require encoding. They're safe everywhere in a URL.

Reserved characters have defined structural meanings. The colon separates scheme from authority. Forward slashes delimit path segments. Question marks introduce query strings. Ampersands separate query parameters. Using these characters literally requires encoding them, similar to how you'd handle special characters when doing Base64 encoding for different contexts.

Everything else โ€” spaces, brackets, quotes, Unicode characters, control characters โ€” must always be encoded.

Common URL Encoding Mistakes That Break Things

Even experienced developers make these errors. Knowing them helps you avoid subtle bugs.

Encoding an already-encoded URL produces double-encoding, where %20 becomes %2520. The resulting URL points to the wrong resource. Always check whether a string is already encoded before encoding it again.

Forgetting to encode user input before adding it to URLs creates security vulnerabilities and broken links. User input is untrusted and unpredictable. Always encode it.

Using + for spaces in URL paths fails because servers don't decode + as space outside query string contexts. Stick with %20 unless you specifically need form encoding.

Decoding too early in the processing pipeline can cause the same character to be interpreted as both syntax and data, creating parsing ambiguities. Decode only when you're ready to use the actual value.

When to Encode, When to Decode

Encoding happens when you're constructing URLs โ€” building links, generating API requests, submitting forms programmatically, creating redirects. You're taking human-readable text and making it URL-safe.

Decoding happens when you're analyzing URLs โ€” reading server logs, interpreting analytics data, debugging requests, extracting information from encoded URLs. You're converting URL-safe format back to human-readable text.

The direction depends on whether you're creating URLs or consuming them.

URL Encoding Across Different Programming Contexts

Every major programming language provides URL encoding functions, though they go by different names. JavaScript uses encodeURIComponent(). Python has urllib.parse.quote(). PHP offers urlencode(). Ruby provides URI.encode_www_form_component(). Java has URLEncoder.encode().

These built-in functions handle the technical details correctly. But web-based encoding tools remain valuable for quick one-off conversions, debugging, testing, and situations where you don't have immediate access to a development environment.

The Relationship Between URL Encoding and Other Encoding Schemes

URL encoding solves one specific problem: making text safe for URLs. Other encoding schemes serve different purposes. HTML encoding protects against cross-site scripting by converting characters that have special meaning in HTML markup. Base64 encoding represents binary data as ASCII text for transmission through text-only channels. Each encoding type addresses a particular context.

Don't confuse them. A URL-encoded string isn't HTML-safe. An HTML-encoded string isn't URL-safe. A Base64-encoded string is neither. Match the encoding to the context.