Skip to content
2C2CCallApp

Developer tools

Base64 and URL Encoding Explained: What They Are and Are Not

Understand Base64 and percent-encoding, why encoding is not encryption, and how to debug real problems such as broken query strings, with a worked example.

Updated Nov 18, 2026 · 8 min read

Base64 and URL encoding appear everywhere in web development: in email attachments, data URLs, API tokens and every link with a query string. They also attract one stubborn misunderstanding, the belief that encoded text is somehow protected. It is not. This guide explains what each encoding does, when to use it, the common bugs it causes and the security point everyone should remember.

Base64: binary data in text clothing

Many systems were built to carry text, not arbitrary bytes. Base64 solves the mismatch by representing binary data with a safe alphabet of 64 characters: uppercase and lowercase letters, digits, plus and slash, with equals signs as padding. Every three bytes become four characters, so the output is roughly a third larger than the input. You find it in email attachments, embedded images in CSS and HTML (data URLs), certificates and the segments of many web tokens.

A common variant is URL-safe Base64, which replaces the plus and slash with a hyphen and an underscore so that the result can sit inside a URL or a file name without further escaping, and often drops the padding.

URL (percent) encoding: making text safe inside addresses

URLs may only contain a limited set of characters, and some of those, such as the question mark, ampersand and equals sign, have special meaning. Percent-encoding writes any other character as a percent sign followed by two hexadecimal digits: a space becomes %20, and an ampersand in a value becomes %26. Without it, a value that contains an ampersand ends the parameter early and silently corrupts the data that follows.

Encoding is not encryption

This is the point to remember. Both encodings are reversible by anyone, instantly, with no key. They exist for compatibility, not secrecy. Never store passwords, tokens or personal data merely “Base64-encoded” and consider them hidden. Use proper encryption for confidentiality and a salted, slow password hash for passwords. If you see a secret in Base64 in a log, it is a secret in plain sight.

A real-world example: a broken marketing link

A marketer builds a campaign link for a landing page. The destination needs a parameter that carries a campaign name including an ampersand: Spring Sale & Clearance. She pastes it straight into the URL as ?campaign=Spring Sale & Clearance. In the analytics report, the campaign shows up as just “Spring Sale”, and there is a mysterious empty parameter named “ Clearance”.

What happened is predictable once you know the rules. The unencoded ampersand told the browser that a new parameter was starting, and the space was handled inconsistently. Encoding the value fixes both problems: ?campaign=Spring%20Sale%20%26%20Clearance. She pastes the original value into an encoder to produce the safe form, tests the link and checks that the full name arrives in the report. The same habit prevents bugs with names containing accents, plus signs, hash symbols and non-Latin characters, which should be encoded as UTF-8 bytes first.

Debugging checklist

  • Double encoding: seeing %2520 usually means a value was encoded twice (%25 is an encoded percent sign).
  • Plus versus %20: in form-style query strings a plus can mean a space; elsewhere it is just a plus.
  • Garbled accents: a character set mismatch. Use UTF-8 consistently.
  • Base64 padding errors: some decoders require the trailing equals signs, others reject them. URL-safe variants often omit them.
  • Whitespace: line breaks inside Base64 are legal in some formats (such as email) and errors in others.

Practical privacy note

Pasting real tokens or personal data into any online tool carries risk. Browser-based tools that run locally reduce it but do not remove it: prefer test values when you can, and rotate any secret you suspect you exposed.

Frequently asked questions

Is Base64 a form of encryption?+

No. Anyone can decode it instantly without a key. Use real encryption for secrets and a salted password hash for passwords.

Why does Base64 make data larger?+

Every three bytes become four characters, so the output is about a third bigger than the input.

What is URL-safe Base64?+

A variant that replaces plus and slash with hyphen and underscore so the result fits inside URLs and file names, and often omits padding.

Why do I see %2520 in my URL?+

The value was percent-encoded twice. %25 is the encoded percent sign, so %20 became %2520.

More guides

All Guides →

Ready to put this into practice?

Encode or decode in one click

Paste text, choose Base64 or URL encoding, and convert instantly in your browser, with UTF-8 and URL-safe Base64 support.

🚀 Try the Tool Live Now

Opens the Base64 & URL Encoder/Decoder · free to use, no sign-up needed to get started