Paste your broken Base64 here and click "Fix Base64!!" to repair itEnter Invalid Base64

What is the Base64 Fixer?

You pasted a Base64 string and it just won't decode. Maybe the `=` padding is missing. Maybe newlines snuck in from an email or chat client. Maybe the URL-safe variant got mixed with the standard one. This tool cleans all of that up. Paste the broken string, hit the button, get something that actually decodes.

Base64 is defined by RFC 4648 — strict 4-character groups, optional `=` padding, two character sets (standard `+/` and URL-safe `-_`). The browser's btoa / atob functions throw the moment any of those rules slip. Wikipedia has a good rundown of where each variant gets used — email MIME, JWT, data URLs, S3 keys. Real-world strings get mangled in transit between all of those, and that's where this fixer earns its keep.

Everything runs in your browser. Your data stays on your machine. Fix the string, copy it back into your code or curl call, move on.

How to Use the Base64 Fixer

Three steps. Each one uses the actual buttons and panels you see on this page.

1

Paste Broken Base64 or Load Sample

Drop your broken Base64 into the left editor. Hit Sample Base64 if you want to see the kind of input the fixer handles. Common patterns it sees in the wild — newlines from email wrapping, missing or extra `=` padding, a stray `-` or `_` mixed with `+` and `/`, junk pasted on at the end:

SGVsbG8gV29ybGQ
U0tVLTEwMQ==-_invalid

The fixer normalises all of these against RFC 4648. It strips whitespace, fixes the padding so the length is a multiple of 4, and (when needed) flips between standard and URL-safe alphabets so the result actually decodes.

2

Click Fix Base64!!

Hit the green Fix Base64!! button. The string goes to the backend, gets parsed and re-emitted, and comes back clean. There's a loading indicator while that's happening — usually a second or two.

3

Review the Output

The right panel shows the repaired Base64. The decoded bytes are identical to whatever your input was meant to represent — only the encoding is fixed. Copy the output, paste it into your decoder, your API call, your data URL, wherever it needed to go.

When You'd Actually Use This

API and JWT Debugging

A token from an API decodes locally but the one in the email doesn't. Nine times out of ten the email client wrapped lines or the URL-safe variant got URL-decoded into something weird. Paste it here and you'll usually have something working in seconds — handy when you're inspecting JWTs by hand.

Recovering Pasted-from-Chat Strings

Slack, Teams, and email all love to insert soft line breaks into long Base64 blobs. Sometimes they replace `+` with a space when copying. The fixer strips both back out.

Standard vs URL-Safe Variants

JWTs use URL-safe Base64. Most APIs and S3 don't. When you're bouncing a value between those worlds the encoding can get scrambled — pad here, swap `-/_` for `+//`, and you're back to a string that decodes.

Data URL Payloads

When a data: URL in your CSS or HTML stops rendering, the Base64 payload is usually the culprit. Paste the whole `data:image/png;base64,...` value — the fixer keeps the prefix intact and repairs only the encoded part.

Common Questions

Is my Base64 stored anywhere?

Nope. Everything happens in your browser. The string never leaves your machine in any form we can read — we don't log it, we don't see it.

What kinds of errors does it fix?

Missing or extra `=` padding, embedded newlines and whitespace, mixed URL-safe (`-_`) and standard (`+/`) characters, stray garbage at the end of the string, and lengths that aren't a multiple of 4. If the underlying bytes are partially missing — say someone truncated the string mid-character — there's only so much we can do.

Does the decoded data stay the same?

Yes. We only normalise the encoding to match RFC 4648. Whatever bytes were meant to come out of `atob` come out the same. We don't touch the underlying content.

Does it handle URL-safe Base64?

Yes. Both the standard alphabet (`+/`) and the URL-safe variant (`-_`) are supported. If your input mixes them, the fixer picks whichever variant looks like the dominant one in the string and normalises to that.

Will it work for image or PDF Base64?

Yep. The contents don't matter to the encoding fix. If you paste a `data:image/png;base64,...` URL the prefix is preserved and only the encoded payload gets repaired.

Is the fixed Base64 always decodable?

For format-level breakage, yes. If the original bytes were partially corrupted (bits missing or rewritten), no encoding fix can recover those — you may decode but get garbage at the corrupted offset. Verify with our Base64 Decoder after.

Other Base64 Tools You Might Need

Fixing the encoding is one step. Here are the other Base64 tools on the site: