Base64 / roundtrip handoff guide

Round-trip Base64 as text or binary without damage

Base64 is not encryption. Decide whether decoded bytes are UTF-8 text or a binary file before restoring them.

Text and binary need different restores

Decode as text only after confirming UTF-8. For images, archives, or arbitrary bytes, save binary instead of forcing a display. Do not safely infer MIME or file type from Base64 alone.

UTF-8 text  → bytes → decode as UTF-8 text
binary data → bytes → save as binary file
Base64 is encoding, not encryption
BoundaryWhat to check
UTF-8Validate the character encoding; do not hide invalid bytes with replacement characters.
binaryKeep unreadable bytes binary and confirm the destination format separately.
alphabetFix standard Base64 +/ versus URL-safe -_.
paddingConfirm whether omitted or restored trailing = is allowed.

Review whitespace and save format

Line-wrapped Base64 from a mail or log has whitespace boundaries. Confirm whether it may be normalized; do not mix wrapping with the payload bytes. Choose extension and MIME by contract, not by guessing from the Base64 string.

The existing Base64 tool converts locally. This guide supports the restore decision and never sends input externally.

Open the existing Base64 tool

Review cases

caseoutcomecheck
utf8-textdecode-as-utf8Validate UTF-8 before displaying.
binary-bytessave-as-binaryDo not coerce arbitrary bytes to text.
url-safe-alphabetalphabet-checkDo not confuse -_ with +/.
missing-paddingpadding-checkConfirm whether omitted = is accepted.
whitespace-wrapnormalize-boundaryDo not mix wrapping whitespace into data.
unknown-file-formatrejectDo not infer MIME or safety from Base64 alone.

Do not paste secrets

Do not paste production tokens, signing keys, or personal data into this guide. Use a harmless fixture and a separate secure handoff for sensitive bytes.