Base64 troubleshooting guide

Fix a Base64 invalid character error

Base64 decoding usually fails because the input contains extra text, a URL-safe alphabet, missing padding, or characters that are not part of standard Base64.

Open Base64 Error Fixer View all tools

Why decoding fails

A Base64 string is easy to damage when it is copied from a header, log line, JSON field, or URL. One extra quote, prefix, space, or URL-safe character can make a strict decoder reject the value.

Example

Input

Bearer SGVsbG8sIDEwMjRiYXNl

Output

SGVsbG8sIDEwMjRiYXNl

How to clean the value

  1. Remove labels such as Bearer, token=, quotes, and surrounding punctuation before decoding.
  2. If the string uses - or _, convert it from URL-safe Base64 or normalize those characters first.
  3. Decode the cleaned value and check whether the result is readable UTF-8 text.

Clean before you decode

Most Base64 decode errors come from copied surroundings, not from the encoded value itself. Remove labels, quotes, commas, and field names before judging the string.

If the value is part of a token format, be careful not to edit signed data and then reuse it as if the signature were still valid.

Common mistakes

  • Copying the word Bearer together with an authorization token
  • Pasting a full JSON field instead of only the Base64 value
  • Using URL-safe Base64 in a standard Base64 decoder
  • Dropping padding characters when a system expects them

Related problems

FAQ

What characters are valid in standard Base64?

Standard Base64 uses A-Z, a-z, 0-9, plus, slash, and optional equals signs for padding.

Can spaces break Base64 decoding?

Line breaks are often ignored, but random spaces inside a copied token can still be a sign that the value was copied incorrectly.

Does a successful decode mean the data is safe?

No. Base64 only changes representation. It does not verify that the decoded content is trusted or harmless.