URL Encoder/Decoder — Percent-Encode & Decode URLs Instantly
Learn why URL encoding exists, how percent-encoding works, the difference between %20 and + for spaces, and how to encode and decode URLs correctly for APIs and query strings.
By sadiqbd · June 6, 2026
URLs have strict rules about which characters are allowed
A URL looks simple until you try to pass arbitrary data in one. Spaces, ampersands, equal signs, hash marks, non-ASCII characters — these all have special meaning or are outright forbidden in different parts of a URL. Passing them unencoded breaks the URL structure; encoding them incorrectly produces requests that don't work.
A URL encoder and decoder handles both directions: encoding a string so it's safe to include in a URL, and decoding an encoded URL back to its original readable form.
Why URL Encoding Exists
URLs can only contain a limited set of ASCII characters. Everything else — spaces, Unicode characters, and "reserved" characters that have structural meaning in URLs — must be percent-encoded: replaced with a % sign followed by the two-hex-digit ASCII code.
Examples:
- Space →
%20(or+in query strings) &→%26(since&separates query parameters)=→%3D(since=separates key from value)#→%23(since#starts a fragment)/→%2F(since/separates path segments)ঢাকা→%E0%A6%A2%E0%A6%BE%E0%A6%95%E0%A6%BE(UTF-8 encoded, then percent-encoded)
Reserved characters
Some characters are reserved — they have structural meaning in URLs. They only need encoding when used as literal data (not for their structural purpose):
! * ' ( ) ; : @ & = + $ , / ? # [ ] ~
Unreserved characters (always safe, never encoded)
A-Z a-z 0-9 - _ . ~
URL Encoding vs. Form Encoding
There are two slightly different encoding standards:
Percent-encoding (RFC 3986) — used in paths and general URL components. Spaces become %20.
application/x-www-form-urlencoded — used in HTML form submissions and query strings. Spaces become +. The + must itself be encoded as %2B if it's a literal plus sign.
This distinction matters: a query parameter value encoded with form encoding (hello+world) decodes correctly in a form handler but might confuse a URL parser expecting hello%20world. Most URL encoder tools let you choose which standard to apply.
How to Use the URL Encoder/Decoder on sadiqbd.com
Encoding:
- Enter the text you want to make URL-safe.
- Select encode.
- The tool returns the percent-encoded version, safe for use in a URL.
Decoding:
- Paste the URL-encoded string (e.g. from a browser address bar, an API response, or a log file).
- Select decode.
- The tool returns the original readable string.
Real-World Examples
Building a search URL
You want to link to a search for "web development Bangladesh":
https://example.com/search?q=web development Bangladesh
This URL is broken — the space and the potential for browser-specific behaviour make it unreliable. Encoded:
https://example.com/search?q=web%20development%20Bangladesh
Or with form encoding:
https://example.com/search?q=web+development+Bangladesh
Encoding a Bangla query parameter
A localised search: q=ঢাকা বিশ্ববিদ্যালয়
URL-encoded:
q=%E0%A6%A2%E0%A6%BE%E0%A6%95%E0%A6%BE%20%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%8D%E0%A6%AC%E0%A6%AC%E0%A6%BF%E0%A6%A6%E0%A7%8D%E0%A6%AF%E0%A6%BE%E0%A6%B2%E0%A6%AF%E0%A6%BC
Modern browsers handle this transparently in the address bar, but when constructing URLs in code or for APIs, encoding must be explicit.
Decoding a URL from a log
A web server access log contains:
GET /products?category=electronics&name=Samsung%20Galaxy%20S24%20Ultra&price_max=150000
Decoding the query string: name=Samsung Galaxy S24 Ultra — immediately readable for analysis or debugging.
API OAuth redirect URI
An OAuth 2.0 redirect URI gets included as a query parameter:
https://auth.example.com/oauth/authorize?
client_id=abc123&
redirect_uri=https%3A%2F%2Fyourapp.com%2Fcallback&
scope=read%20write
The redirect_uri value https://yourapp.com/callback becomes https%3A%2F%2Fyourapp.com%2Fcallback — the :// and / are encoded because they appear inside a query parameter value where they would otherwise confuse the URL parser.
Decoding it for verification: the URL encoder/decoder reveals the original callback URL immediately.
Parsing a complex URL
Encountering a URL in code review:
https://api.example.com/v1/search?filter=%7B%22status%22%3A%22active%22%2C%22tag%22%3A%22dev%22%7D
Decode the filter parameter value: {"status":"active","tag":"dev"} — a JSON object passed as a URL parameter. Understanding what's actually being sent becomes immediate.
Common Mistakes With URL Encoding
Double-encoding. If you encode an already-encoded URL, %20 becomes %2520 (the % gets encoded to %25). The receiver then decodes it to %20 instead of a space. Always encode raw data, not already-encoded data.
Not encoding the right part. The URL https://example.com/path?key=value has several components: scheme, host, path, query key, query value. Each may need different encoding. Encoding the full URL including the :// and / breaks it. Encode only the data portions — query parameter values, path segments where needed.
Forgetting to encode in code. Manually concatenating strings into URLs without encoding is a common bug: url = base + "?name=" + userName. If userName contains &, =, or #, the URL breaks. Use your language's URL encoding function: encodeURIComponent() in JavaScript, urllib.parse.quote() in Python, URLEncoder.encode() in Java.
Confusing + and %20 for spaces. Both represent spaces, but in different contexts. + is only valid for spaces in query strings (form encoding). In path segments, always use %20.
Tips for Working With URLs
Use encodeURIComponent() (not encodeURI()) for parameter values in JavaScript. encodeURI() preserves structural URL characters like /, ?, and &. encodeURIComponent() encodes them — correct for encoding individual parameter values.
Decode before displaying. When showing a URL to a user in your UI, decode it first. %E0%A6%A2%E0%A6%BE%E0%A6%95%E0%A6%BE in a search box is unhelpful; ঢাকা is what they actually typed.
Test with non-ASCII input. Most URL encoding bugs only surface with non-Latin characters. Test your URL construction code with Bangla, Arabic, Chinese, or emoji input before shipping.
Frequently Asked Questions
What's the difference between encodeURI and encodeURIComponent in JavaScript?
encodeURI() encodes a full URL, preserving structural characters like ://, /, ?, &, =. encodeURIComponent() encodes a component (like a query parameter value), encoding everything except unreserved characters. For encoding individual parameter values, always use encodeURIComponent().
Why do URLs sometimes have + instead of %20 for spaces?
+ is the form-encoded representation of a space, used in query strings from HTML form submissions. %20 is the percent-encoded representation, used in RFC 3986. Both are valid in query strings; %20 is valid everywhere; + is only valid in query strings.
What does %2F in a URL path mean?
%2F is an encoded forward slash /. In a path, / is a path separator; %2F is a literal slash within a path segment. Some servers treat them differently — check your framework's behaviour.
Is URL encoding the same as HTML encoding?
No. URL encoding uses %XX format. HTML encoding uses named entities (&, <) or &#XX; numeric format. They serve different purposes and are not interchangeable.
Is the URL Encoder/Decoder free? Yes — completely free, no sign-up needed.
URL encoding is one of those things that works invisibly when done correctly and causes mysterious failures when it isn't. The encoder/decoder makes both directions immediate — whether you're building query strings, debugging API calls, or just trying to read what's in a complex URL.
Try the URL Encoder/Decoder free at sadiqbd.com — encode any text for safe URL use, or decode any encoded URL instantly.