Base64 Repair
Paste broken Base64 and this fixes the common breakage — it strips whitespace and newlines, removes any data: prefix, converts URL-safe -/_ back to standard +//, drops stray non-Base64 characters, and re-adds the correct = padding — then confirms it decodes. Everything runs in your browser — nothing is uploaded.
How to fix broken Base64
Paste the string that won't decode into the input above. The tool runs a fixed sequence of repairs: it trims the ends, removes a data: prefix if present, strips all whitespace and line breaks, converts URL-safe - and _ to standard + and /, drops any character outside the Base64 alphabet, and finally re-adds = padding so the length is a multiple of 4. It lists every change it made, then test-decodes the result and tells you whether it's now valid. Click Copy to grab the repaired string.
Common causes
Most "invalid Base64" errors come down to one of four things:
- Whitespace / line wrapping. Base64 from the
base64CLI, MIME encoders, or PEM-style tools is wrapped at 64 or 76 columns; many decoders reject the embedded newlines. - A leftover
data:prefix. Copying from a data URI leavesdata:image/png;base64,at the front, which isn't part of the Base64 payload. - The URL-safe variant. URL-safe Base64 uses
-and_in place of+and/; a standard decoder chokes on them. See Base64 URL-safe. - Missing padding. If the trailing
=characters were stripped, the length isn't a multiple of 4 and strict decoders fail. See Invalid Base64 Padding.
What this can't fix
Repair fixes formatting and encoding problems, not missing data. If the Base64 was truncated — cut off by a log limit, a database column, or a bad copy/paste — or the bytes are genuinely corrupt, no amount of re-padding brings them back. In that case the tool still cleans up the formatting, but it warns you that the result may decode to incomplete or garbled data. The only real fix for truncated Base64 is to re-copy the complete original string.
Is this private?
Yes. Every step runs fully in the browser with JavaScript — your Base64 is repaired and test-decoded locally, and nothing is uploaded to any server. You can confirm in DevTools → Network: repairing fires no request.
Frequently asked questions
How do I fix broken Base64?
Paste it into the repair tool above. It strips whitespace and line breaks, removes any data: prefix, converts URL-safe -/_ back to standard +//, drops stray non-Base64 characters, and re-adds the correct = padding, then confirms whether the result decodes. Click Copy to grab the fixed string.
Why won't my Base64 decode?
The most common reasons are whitespace or line wrapping inside the string, a leftover data: prefix, the URL-safe variant (- and _ instead of + and /), or missing = padding so the length isn't a multiple of 4. The repair tool fixes all four automatically.
Can this recover truncated or corrupt Base64?
No. Repair fixes formatting and encoding problems, but it cannot recover data that was cut off or corrupted. If bytes are genuinely missing, the decoded result will still be incomplete — the tool warns you when the formatting is fixed but the data may still be broken.
Is the Base64 repair tool private?
Yes. Every step runs in your browser with JavaScript — your Base64 is repaired and test-decoded locally, and nothing is uploaded to any server.
Need plain Base64 encode/decode?
The main base64.dev tool handles text, files, and URL-safe mode with auto-detect.
Open base64.dev →