Skip to content

Base64 Repair Tool

Repair broken Base64 strings by removing spaces, line breaks and invalid characters and restoring the missing = padding.

Runs in your browser Free, no sign-up
Loading tool workspace...

What is Base64 Repair Tool?

This Base64 repair tool fixes the problems that most often stop a Base64 string from decoding. Base64 copied out of emails, logs, PDFs or chat apps tends to pick up line breaks, spaces, quotes and other stray characters, or loses its trailing = padding, and decoders then fail with "invalid character" or "incorrect padding" errors.

Paste the broken string and the repaired version appears instantly: every character outside the standard Base64 alphabet is removed and the = padding is recalculated, so the result is ready to decode or validate.

How to use Base64 Repair Tool

  1. Paste the broken Base64 string into the input panel.
  2. The repaired string appears in the output panel straight away.
  3. Copy it, or check it with the Base64 Validator.
  4. Decode it with the Base64 Decoder to confirm the content is what you expected.

Key features

  • Removes spaces, line breaks, quotes and other invalid characters
  • Recalculates and restores = padding
  • Instant output as you paste
  • Works with long, multi-line Base64 blocks
  • Runs in your browser; your data is not uploaded

Common use cases

  • Fixing Base64 copied from emails, PDFs and chat messages
  • Cleaning line-wrapped MIME Base64 before decoding
  • Restoring padding removed by systems that strip trailing = signs
  • Recovering Base64 values from logs with surrounding quotes or escapes
  • Preparing Base64 for strict decoders that reject whitespace

Technical details & standards

Repair keeps only characters in the standard Base64 alphabet (A–Z, a–z, 0–9, + and /) and removes everything else, including whitespace, line breaks, quotes and existing = signs, then adds = padding until the length is a multiple of 4, as RFC 4648 requires.

Two cases cannot be fully repaired. URL-safe Base64 uses - and _ instead of + and /; those characters are removed here, so convert them first (replace - with + and _ with /). And if characters were lost from the middle of the string, padding restores the format but not the missing data; a string whose cleaned length leaves a remainder of 1 when divided by 4 is truncated and needs the original source.

Frequently asked questions

How do I fix "incorrect padding" errors?

Base64 length must be a multiple of 4, padded with = at the end. Paste the string here and the correct number of = characters is added automatically.

Why does Base64 contain line breaks?

MIME email encoding and tools such as OpenSSL wrap Base64 at 64 or 76 characters per line. Most decoders require the line breaks to be removed, which this tool does.

Can it repair URL-safe Base64?

Not directly: the URL-safe characters - and _ are removed as invalid. Replace - with + and _ with / first, then repair, or decode URL-safe Base64 directly with the Base64 Decoder.

Will repairing change my data?

It only removes characters that are not valid Base64 and adds padding, so the encoded data is unchanged. If the string was truncated or had characters deleted, the missing bytes cannot be recovered.

Is my data safe?

Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.

Does it work offline?

Once the page has loaded, this tool can process input without an internet connection.

More validators & checkers tools

View all