Invalid Base64: find the actual error
A rejected string can have a valid alphabet and still be malformed. Inspect the exact rule it violates.
Open the workbench ↗Read the error in source coordinates
Base64 validation happens before byte decoding. Its offsets refer to zero-based positions in the encoded source, not output bytes. If an illegal character occurs at source offset 4, look at the fifth input character. The tool preserves your input so you can compare the error against the original evidence.
Five distinct failure classes
| Input | Error | Meaning |
|---|---|---|
| Zg! | Illegal symbol | ! is outside the alphabet |
| Z | Impossible length | One remaining symbol cannot produce a byte |
| Z=g= | Interior padding | = may only appear at the end |
| Zg= | Incorrect padding | Two data symbols require two = signs |
| Zh== | Non-canonical bits | Unused low four bits are nonzero |
A three-symbol ending needs one = sign in a padded form. Its last symbol must have two zero low bits. Zm8= is canonical for “fo”; Zm9= is rejected even if a lenient decoder produces the same bytes.
Whitespace is a policy decision
Some transport formats allow wrapped lines. This inspector uses a strict RFC-style profile and rejects whitespace rather than guessing a transport format. A pasted trailing newline is visible as an error. Remove it only after confirming the source protocol allows that normalization. This tool does not offer silent cleanup, because cleanup changes the source you are investigating.
Wrong alphabet versus missing padding
If a string contains - or _, select Base64URL. Do not swap characters as a speculative repair. If an otherwise valid URL-safe segment omits =, choose Optional or Forbidden only when that matches its protocol. The tool does not relax canonical pad-bit checks when padding is omitted.
Base64 validity and text validity are separate
wyg= is canonical Base64 for the bytes C3 28. Those bytes are invalid UTF-8: C3 starts a two-byte sequence, but 28 is not a continuation byte. The Base64 and hex panels remain lossless. Strict text decoding rejects the sequence at byte offset 0. Replacement mode displays U+FFFD followed by “(” and labels the result lossy.
If you download the original bytes, you get C3 28. Re-encoding replacement text as UTF-8 yields EF BF BD 28. That mismatch is evidence of loss; a readable preview is not proof that decoding was faithful.
Before you change the source
- Confirm the alphabet and padding contract from the producer.
- Read the first source error; fix only what you can justify.
- Inspect decoded bytes independently of text.
- Keep a local session download if you need to reproduce the inspection. It includes the source and should be treated as sensitive.
Every operation is a single layer. The inspector never loops through recursive decoding, executes decoded markup, or opens a decoded URL. Base64 is a representation, not encryption.
References and reproducibility
Encoding rules: RFC 4648 §§3–5 and 10. UTF-8 decoding and BOM behavior: WHATWG Encoding Standard. The workbench uses browser-native text and binary primitives with explicit validation. It does not normalize Unicode or remove line endings.