URL Encode / Decode

Encode and decode URLs instantly — 100% client-side, no data leaves your browser.

Input
Output
Ready — 100% client-side processing, no data leaves your browser.
Mode: Encode Size change: 0 Processed in 0ms

URL Encode


URL Encode / Decode Online: The Only Guide You’ll Need

Ever copied a link into a browser bar and watched spaces turn into %20, or pasted a search query into an API request and had it silently break? That’s URL encoding at work — and if you’ve ever needed to fix, inspect, or generate one of these strings, you already know how fiddly it can get by hand.

This guide walks through what URL encoding actually does, when you need it, and how to handle it whether you’re working online, in JavaScript, in Python, or with an npm package — plus where to do it instantly with a free URL encode decode online tool.

What is URL encoding?

URLs can only safely contain a limited set of characters — letters, digits, and a handful of symbols like -, _, ., and ~. Everything else (spaces, &, ?, #, non-English characters, emoji) has to be converted into a %XX sequence, where XX is the character’s hex byte value. A space becomes %20, an ampersand becomes %26, and so on. This process is formally called percent-encoding, though most people just call it “URL encode.”

URL decode is simply the reverse: turning %20 back into a space, %26 back into &, and reconstructing the original readable text.

Why you’d need to url encode decode online

A few common situations where this comes up:

  • Building query strings — passing user input, search terms, or filter values through a URL without breaking the request.
  • Debugging API calls — decoding a mangled parameter to see what was actually sent.
  • Sharing links — encoding URLs that contain spaces, accented characters, or symbols so they don’t break when pasted into email or chat.
  • Working with legacy systems — some tools double-encode or mis-encode data, and you need to manually decode it to trace the issue.

For quick, one-off jobs, opening a code editor is overkill. That’s exactly the gap a browser-based url decode online tool fills — paste the string, get the result, done. InspoTool’s URL Encode/Decode tool runs entirely client-side, so nothing you paste in ever leaves your browser.

URL encode decode javascript

JavaScript has this built in — no libraries needed:

// Encode
const encoded = encodeURIComponent("hello world/foo?bar=1");
console.log(encoded); // hello%20world%2Ffoo%3Fbar%3D1

// Decode
const decoded = decodeURIComponent(encoded);
console.log(decoded); // hello world/foo?bar=1

Two functions matter here, and mixing them up is the most common mistake:

  • encodeURIComponent() encodes everything that isn’t a letter, digit, or - _ . ! ~ * ' ( ). Use this for individual values you’re inserting into a query string (a search term, a filename, a piece of user input).
  • encodeURI() leaves reserved URL characters like /, ?, &, and : untouched, because it assumes you’re encoding a complete URL, not a single value. Use this when encoding a full link rather than one parameter.

Decoding uses the matching pair: decodeURIComponent() and decodeURI().

URL encode decode python

Python’s standard library handles this through urllib.parse:

from urllib.parse import quote, unquote

encoded = quote("hello world/foo?bar=1")
print(encoded)  # hello%20world%2Ffoo%3Fbar%3D1

decoded = unquote(encoded)
print(decoded)  # hello world/foo?bar=1

A couple of Python-specific notes:

  • quote() encodes spaces as %20 by default. If you need the older +-for-space convention (common in form submissions), use quote_plus() and unquote_plus() instead.
  • For encoding a full dictionary of query parameters at once, urllib.parse.urlencode({"q": "hello world", "page": 2}) builds the whole query string for you.

URL encode decode npm

If you’re working in Node.js, the built-in encodeURIComponent/decodeURIComponent functions (same as browser JavaScript) usually cover it — no install required. For more advanced query-string handling, two popular npm packages fill in the gaps:

npm install query-string
import queryString from "query-string";

const encoded = queryString.stringify({ q: "hello world", page: 2 });
// q=hello%20world&page=2

const parsed = queryString.parse("q=hello%20world&page=2");
// { q: "hello world", page: "2" }

query-string (and the similar qs package) are worth reaching for when you’re building or parsing entire query strings with multiple parameters, arrays, or nested objects — territory where manual encodeURIComponent calls get repetitive fast.

Doing it online, without writing any code

Not every situation calls for opening an editor. If you just need to convert a string once — checking what a tracking link decodes to, cleaning up a URL before sharing it, or prepping a value for a spreadsheet — a browser tool is faster than spinning up a script.

InspoTool’s URL Encode / Decode tool covers exactly that use case:

  • Switch between Encode and Decode modes, or let it auto-detect which one you need
  • Live preview as you type
  • Runs 100% client-side — nothing is uploaded or logged
  • Copy or download the result directly
  • No signup, no limits, works on mobile

It sits alongside similar utilities — HTML Encode, Base64 Encode/Decode — in InspoTool’s text tools collection, so if URL encoding turns out not to be exactly what you needed, the related tool is one click away.

Quick reference

TaskTool
One-off conversion, no setupInspoTool URL Encode/Decode
In-browser JavaScriptencodeURIComponent() / decodeURIComponent()
Node.js scriptsBuilt-in functions, or query-string npm package
Python scriptsurllib.parse.quote() / unquote()

Whichever route you take, the underlying idea is the same: percent-encoding exists so that URLs can carry any character safely. Pick the method that fits where you’re already working — code when you’re scripting something repeatable, an online tool when you just need the answer right now.

URL encoder/decoder FAQ

Q : What’s the difference between URL encoding and Base64 encoding?

Ans : URL encoding replaces unsafe characters with %XX hex codes so a string can live safely inside a URL. Base64 encoding converts binary data into a compact text format for things like embedding images or tokens — it’s not designed for URLs specifically, and Base64 output often still needs URL encoding if it’s placed inside a query string (because +, /, and = aren’t URL-safe).

Q : Why does encodeURIComponent() give a different result than encodeURI()?

Ans : encodeURIComponent() escapes every character outside its safe list, including /, ?, &, and : — it’s meant for a single value. encodeURI() leaves those characters alone because it assumes you’re encoding a whole URL, where they’re structurally meaningful. Using the wrong one either double-encodes a full link or breaks a query parameter that contains a / or &.

Q : Is it safe to paste sensitive URLs into an online encoder?

Ans : It depends on the tool. Ones that process everything client-side (in your browser, via JavaScript) never send your data anywhere, so it’s safe even for internal links or tokens. Always check whether a tool advertises client-side processing before pasting anything sensitive — InspoTool’s URL Encode/Decode tool is one that does.

Q : Why does decoding sometimes fail with an error?

Ans : decodeURIComponent() throws if the string contains a malformed % sequence — for example, a stray % not followed by two valid hex digits. This usually means the string was encoded incorrectly, encoded twice, or isn’t actually URL-encoded to begin with.

Q : What’s “double encoding” and how do I fix it?

Ans : Double encoding happens when a string gets run through an encoder twice, turning %20 into %2520 (since the % itself gets encoded the second time). To fix it, decode the string twice in a row, or decode once and check whether % characters remain — if they do, decode again.

Q : Do I need to encode an entire URL, or just parts of it?

Ans : Just the parts that contain user input or special characters — usually query parameter values. The scheme (https://), domain, and path structure should stay as-is; encoding those can break the link entirely.