🎁 Get $100 FREE on your first $500 recharge·Limited-time bonus for new users·Sign up & claim your $100 instantly·$100 bonus on $500+ first deposits·Apply once, instant credit on signup·
* T&C apply
Live, free, no signup

Free URL encoder & decoder for percent encoding online

Encode or decode URLs and query parameters instantly. Choose encodeURIComponent or encodeURI, handle UTF-8 and spaces correctly, and copy the result — all live in your browser, nothing uploaded.

Free No signup Private — nothing uploaded Live as you type
Plain text / URL
Encoded output
Common percent-encodingsReserved characters you will see most
space%20
&%26
?%3F
#%23
/%2F
+%2B
=%3D
@%40

100% in-browser. Your text never leaves your device — no upload, no logging.

What you get

Everything you need to escape a URL correctly

Encode & decode

One tool, both directions. Flip between encoding plain text and decoding percent-escaped URLs with a single toggle.

Two functions

Pick encodeURIComponent for a single query value or path segment, or encodeURI to escape a whole URL without breaking its structure.

UTF-8 safe

Accented letters, emoji and non-Latin scripts are encoded as their UTF-8 bytes, exactly the way browsers and servers expect them.

Safe decoding

Malformed input — a lone % or a broken escape — shows a clear error instead of crashing, so you always see what went wrong.

Live & instant

Conversion runs as you type, with Copy, Clear and Swap controls to move the output straight back into the input.

Private by default

Everything runs in your browser. Internal URLs, tokens and query data never leave your device — no upload, no logging.

URL encoding — also called percent-encoding — rewrites characters that are unsafe or reserved in a web address as a percent sign followed by a hexadecimal code, so a space becomes %20 and an ampersand becomes %26. That one rule keeps links from breaking when they contain spaces, symbols or non-English text. A good url encoder decoder does both halves of the job: it escapes text so it is safe to drop into a URL, and it reverses the process so you can read an encoded link back as plain text. This page is a url encoder and url decoder in one, running entirely in your browser. Below is everything you need to understand percent encoding, pick the right function, and avoid the mistakes that silently break tracking links and API calls.

What is URL encoding (percent encoding)?

A URL is only allowed to contain a limited set of characters. The specification that governs this, RFC 3986, divides the character space into groups: a small set of always-safe characters, a set of reserved delimiters that have special meaning, and everything else. When you need to put a character from that “everything else” bucket into a URL — or a reserved character that you want treated as data rather than as a delimiter — you url encode it.

The mechanism is simple. Each byte that needs escaping is written as a % followed by its two-digit hexadecimal value. A space is byte 0x20, so it becomes %20. An ampersand is 0x26, so it becomes %26. This is why the technique is called percent encoding, and why you will sometimes hear it described as url escape — you are escaping the character so the browser and server do not misread it.

Decoding simply reverses the lookup: the decoder scans for every %, reads the two hex digits that follow, and turns them back into the original byte. Because encoding and decoding are exact inverses, a correctly encoded value always round-trips back to the text you started with — which is the quickest way to confirm a link is built right.

Reserved vs unreserved characters

The single most useful thing to internalise is which characters are safe and which are not. Get this right and most encoding decisions become obvious.

Unreserved characters (never encoded)

These are always legal in a URL and should never be escaped: the letters A–Z and a–z, the digits 0–9, and the four marks - (hyphen), _ (underscore), . (period) and ~ (tilde). A correct uri encoder leaves all of these untouched.

Reserved characters (delimiters)

These have structural meaning in a URL: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. They separate the scheme, host, path, query and fragment. Whether you encode them depends entirely on whether you mean them as a delimiter or as literal data — which is exactly the distinction the two JavaScript functions below are built around.

CharacterEncodedRole in a URL
space%20Not allowed raw; always encode
&%26Separates query parameters
?%3FStarts the query string
#%23Starts the fragment / anchor
/%2FPath separator
+%2BLiteral plus (not a space)
=%3DSeparates key and value

encodeURIComponent vs encodeURI: the key difference

JavaScript ships two encoding functions, and choosing the wrong one is the most common percent-encoding mistake. This tool lets you switch between them, with encodeURIComponent as the default because it is the one you want most of the time.

encodeURIComponent encodes a single component — one query value, one path segment, one piece. It escapes the reserved delimiters & ? / # = : @ + as well as spaces, because inside a single value those characters are data, not structure. This is what you reach for when building a query parameter.

encodeURI encodes a whole URL and deliberately leaves the structural characters alone, so the result is still a usable address. It will encode a space to %20 but it will not touch & ? / # =, because doing so would break the URL into nonsense. Use it only when you have a complete URL that you want to make safe without dismantling it.

InputencodeURIComponentencodeURI
a b&ca%20b%26ca%20b&c
?x=1%3Fx%3D1?x=1
path/topath%2Ftopath/to

The rule of thumb: encode the value, not the whole link. Build each query value with encodeURIComponent, then join them with the raw & and = delimiters yourself. Reach for encodeURI only in the narrow case where you already hold a finished URL.

When should I URL-encode a query parameter?

Query parameters are where encoding matters most, because their values are user- and data-driven. Encode a parameter value whenever it might contain anything beyond plain letters and digits:

  • Search terms: ?q=link building & seo must become ?q=link%20building%20%26%20seo, or the & is read as a new parameter.
  • Email addresses: the @ and any + tag need escaping in some contexts.
  • Redirect URLs: a URL passed as a value — ?return=https://site.com/a?b=1 — must be fully encoded so its own ? and & do not leak into the outer query.
  • Campaign names: a UTM value with spaces breaks analytics unless encoded. Build clean tracking links with the UTM builder, which handles this for you.

Spaces: %20 vs the plus sign

Spaces cause more confusion than any other character. There are two conventions. In a URL path, and whenever you use encodeURIComponent or encodeURI, a space is written as %20. In the application/x-www-form-urlencoded format that HTML forms use for the query string, a space is historically written as +.

Both can be valid, but they are not interchangeable everywhere. A literal + in a value must itself be encoded as %2B, or a server that treats + as a space will corrupt your data — a phone number like +1 555 can arrive as 1 555 with the plus silently turned into a space. For that reason %20 is the safer, more portable choice, and it is what this encode url online tool produces.

UTF-8 percent-encoding and non-ASCII text

URLs were originally limited to ASCII, but the modern web is full of accented letters, emoji and non-Latin scripts. The solution is to encode each character as its UTF-8 bytes, then percent-encode those bytes. A single character can therefore turn into several escapes.

For example, the character é is two bytes in UTF-8 and encodes to %C3%A9. The Hindi word नमस्ते expands to a long run of three-byte escapes. Emoji, which live outside the basic plane, become four-byte sequences. This tool uses the browser’s native UTF-8 handling, so the output matches exactly what servers and other languages expect — no mojibake, no guessing at code pages.

Encoding URLs in JavaScript and Python

This tool mirrors the behaviour of the standard library functions, so you can prototype here and copy the logic into code.

JavaScript

  • encodeURIComponent(value) for a single query value or path segment.
  • encodeURI(url) for a whole URL.
  • Better still, let the platform build the query for you: new URLSearchParams({ q: 'a & b' }).toString() handles escaping safely.
  • decodeURIComponent and decodeURI reverse the two encoders.

Python

  • urllib.parse.quote(value) is the rough equivalent of encodeURIComponent (note it leaves / alone by default — pass safe='' to encode it too).
  • urllib.parse.quote_plus(value) encodes spaces as + for form data.
  • urllib.parse.unquote(value) decodes percent-escapes back to text.

Small differences in which characters each function treats as “safe” are why a quick check in a neutral url decode tool is useful before you ship — paste the output of your code here and confirm it round-trips cleanly.

Double encoding: the pitfall that breaks links silently

Double encoding is the classic percent-encoding bug. It happens when you encode a string that is already encoded. Because % is itself a reserved character, encoding %20 again turns the % into %25, giving %2520. The link still looks plausible, but a space now arrives as the literal text %20.

The symptoms are telling: query values show stray %2520 or %253D sequences, redirect URLs land on a page that does not exist, and analytics report campaign names full of %20. The fix is discipline: encode a value exactly once, and if you are unsure whether a string is already encoded, decode it first in this tool. If decoding changes nothing, it was plain text; if it reveals readable characters, it was already encoded and you should not encode it again. The Swap button makes this round-trip easy — decode, inspect, then encode once if needed.

Using percent encoding in APIs and UTM links

Two everyday jobs lean heavily on encoding. The first is calling APIs: path parameters and query strings in REST requests must be encoded so that IDs with slashes, search filters with spaces, or signatures with + and / characters are transmitted intact. An unencoded + in an OAuth signature is a notorious source of “invalid signature” errors.

The second is marketing links. UTM parameters — utm_source, utm_medium, utm_campaign — frequently contain spaces or ampersands, and an unencoded value fractures the tracking in your analytics. Rather than hand-encode each one, use the dedicated UTM builder to assemble correct, encoded campaign URLs, and keep this encoder nearby for the one-off values it does not cover. You will find both, plus the rest of the utilities, on the free SEO tools index.

A worked example, step by step

Suppose you want to link to a search results page for the phrase link building & SEO and anchor it to a specific section. The raw, un-encoded attempt looks like this:

  • Naive URL: https://serpbays.com/search?q=link building & SEO#results

This is broken in three places. The spaces are illegal, the & inside the value is read as the start of a second parameter, and the # would normally begin a fragment. The fix is to encode only the value of q with encodeURIComponent, leaving the structural ?, = and # in place:

  • Correct URL: https://serpbays.com/search?q=link%20building%20%26%20SEO#results

Notice that the space became %20 and the ampersand inside the value became %26, but the ? that opens the query and the # that opens the fragment were left untouched because they are doing their structural job. Paste the naive version into the tool above in encode mode to watch this happen, then use the Swap button and decode mode to turn it back into readable text.

Common percent-encoding mistakes to avoid

Most encoding bugs come down to a handful of recurring errors. Scan this list before you ship a link or an API call:

  • Encoding the whole URL with encodeURIComponent: this escapes the :// and every delimiter, producing a single unusable blob. Encode components, not the full address.
  • Forgetting to encode a nested URL: a redirect target passed as a query value must be fully encoded, or its own ? and & hijack the outer query string.
  • Treating + as always meaning a space: in a path it is a literal plus; only form-encoded query strings read it as a space. Encode a literal plus as %2B to be safe.
  • Double encoding: running an already-encoded string through the encoder again, turning %20 into %2520.
  • Encoding unreserved characters needlessly: escaping letters, digits or - _ . ~ is harmless but ugly and can defeat caching and deduplication.

Decoding safely and handling malformed input

Decoding is the reverse of encoding, and it is where most crashes happen. A percent sign must always be followed by exactly two valid hexadecimal digits. If the input contains a lone %, or a truncated escape like %E0%A4 that is missing its final byte, the decode function throws an error rather than returning garbage.

This tool catches those errors and shows a clear, specific message instead of breaking, so you can see exactly where the problem is and fix the input. That makes it safe to paste log excerpts, half-copied URLs or hand-typed escapes without worrying about the page locking up. If a decode fails, check first for a stray % that should have been encoded as %25, which is by far the most common cause.

Privacy: why in-browser encoding matters

This url encoder decoder runs entirely in your browser using JavaScript. Nothing you type or paste is sent to a server, stored or logged — the encoding and decoding happen on your own device. That matters because the strings people encode are often sensitive: internal admin URLs, API endpoints, access tokens embedded in query parameters, signed links and customer data.

Any tool that processes those strings on a remote server is a place your secrets could be retained or exposed. In-browser conversion removes that risk entirely, which is why a privacy-respecting encoder is the safer default. You can work offline, close the tab, and leave no trace behind. Paste a URL into the tool above to encode or decode it in real time, switch functions to see how encodeURIComponent and encodeURI differ, and use Swap to round-trip any value with confidence.

Pair it with the rest of the free toolkit

Building tracking links? Assemble correctly encoded campaign URLs with the UTM builder. The full index of free utilities lives at /tools.

Browse all free SEO tools
FAQ

URL encoding questions, answered

  • URL encoding, also called percent-encoding, replaces characters that are unsafe or reserved in a URL with a % followed by their hexadecimal byte value. A space becomes %20 and an ampersand becomes %26. It lets you put spaces, symbols and non-English text into a link without breaking its structure, because only a limited set of ASCII characters are legal in a raw URL.

  • encodeURIComponent encodes a single piece of a URL — one query value or path segment — so it escapes reserved characters like & ? / # =. encodeURI encodes a whole URL and deliberately leaves those structural characters intact so the link still works. Use encodeURIComponent for query parameter values and encodeURI only for a complete URL you do not want to break apart.

  • Spaces are not allowed in a URL, so they must be encoded. In a path or with encodeURIComponent a space becomes %20. In the query string of an HTML form submission (the application/x-www-form-urlencoded format) a space is often written as + instead. Both can be correct; %20 is the safer, more portable choice and is what this tool produces.

  • Encode a query parameter value whenever it may contain spaces, reserved characters (& = ? # +), or non-ASCII text. For example a search term, an email address, a redirect URL, or a UTM campaign name with spaces all need encoding. Skipping it can truncate the value or break the rest of the query string, which is a common source of broken tracking links.

  • Unreserved characters — letters A–Z a–z, digits 0–9, and - _ . ~ — never need encoding. Everything else may need it: spaces, reserved delimiters like & ? # / : @, and any non-ASCII character such as accented letters or emoji, which are encoded as their UTF-8 bytes.

  • Double encoding happens when you encode text that is already encoded. The % in %20 gets re-escaped to %2520, so a space becomes %2520 instead of %20. It usually breaks links silently. Decode a value once before re-encoding it, and never run an already-encoded URL through the encoder a second time.

  • Yes. The encoder and decoder run entirely in your browser with JavaScript. Nothing you paste is sent to a server, stored or logged, so you can safely encode internal URLs, tokens or confidential query data without it ever leaving your device.

  • Yes, completely free with no signup, no limits and no watermark. Encode and decode as many URLs as you like. It is one of a set of free utilities Serpbays offers alongside the UTM builder and the rest of the free SEO tools.

Clean links deserve to be found

Encoding your URLs correctly is step one. Getting the page ranked is step two — that takes authority links. See how Serpbays builds them.

Start free on Serpbays