Why this tool exists
The Base64 Lab keeps encode/decode workflows in one place with presets for URL-safe alphabets, RFC-style wrapping, whitespace normalization, and binary-aware previews.
API tokens & headers
Encode `client_id:secret` pairs or JSON payloads before shipping them through curl, Postman, or task runners.
Wrapped payload cleanup
Normalize Base64 copied from terminals, logs, or emails by stripping whitespace and re-wrapping to 64 or 76 characters.
Binary inspection
Decode blobs to confirm contents; when bytes show up we render a hex preview so you can validate attachments safely.
Quick start
Pick a mode, tweak alphabet or wrapping, run the request, and copy the normalized payload without touching your terminal.
- Open the Base64 Lab from the tools directory and pick Encode or Decode before pasting data so the correct controls unlock.
- Adjust the alphabet, wrapping, padding, or whitespace toggles to match your target environment—load a quick sample if you need inspiration.
- Submit the form to run everything server-side, then copy the rendered output or one of the provided code snippets.
Supported inputs
- Accepts UTF-8 text, JSON, or CLI strings for encoding—payloads stay on the server so large blobs remain fast.
- Decoding tolerates whitespace, tabs, and line breaks; enable “Strip whitespace” to normalize wrapped payloads first.
- URL-safe tokens using -_ are supported, and auto-padding can append `=` characters when upstream services omit them.
Mode 01
Encode workflow
- Switch to Encode mode and paste raw text or one of the preset samples to bootstrap your session.
- Set the wrapping behavior to None, 64 characters, or RFC 2045-friendly 76 characters so the output matches CLI or email expectations.
- Toggle the alphabet button to move between Standard (+ /) and URL-safe (- _) variants without editing your input.
- Decide whether to strip trailing padding before sharing tokens. Submit to generate wrapped lines plus copy-ready output and snippets.
Mode 02
Decode workflow
- Choose Decode mode and paste any Base64 string—line breaks, tabs, and spaces are fine if “Strip whitespace” is on.
- Enable URL-safe alphabet if the input uses -_. The lab automatically translates to +/ behind the scenes before decoding.
- Auto-pad fixes payloads that arrive without enough `=` characters, preventing manual edits for quick investigations.
- When the decoded data is binary we show a hex preview and change the copy button to Base64 so you can move the bytes without corrupting them.
Controls & presets
Quick samples, wrap presets, and alphabet toggles expose every knob you need while mirrors of each setting show up in the insights card.
- Quick samples are grouped by mode, so each preset loads the right alphabet, wrap option, and whitespace settings in one click.
- Wrap options rely on server-side chunking which means even long payloads stay accurate compared to local terminal tooling.
- Alphabet, padding, and whitespace toggles double as documentation—each option reflects back inside the insights card after every run.
Outputs, insights & snippets
Status badges, binary warnings, and stats keep every run transparent while curated snippets mirror what you would do in PHP or the shell.
- Status badges swap between “Encoding ready”, “Decoded successfully”, or “Invalid Base64 input” so you always know what happened.
- Binary results trigger a caution block explaining what was detected plus the exact hex preview for the first bytes.
- The insights card tracks alphabet, input length, output length, wrap preset, whitespace stripping, and padding actions by mode.
Snippet references
PHP encode
Use `Str::toBase64()` or `base64_encode` for quick token generation.
PHP decode
Call `base64_decode($input, true)` to mimic the strict validation the lab performs.
Linux shell encode
Pipe text through `openssl base64` to reproduce wrapped output.
Linux shell decode
Use `openssl base64 -d` for parity with the Decode workflow.
Field notes
Lightweight habits that keep Base64 conversions predictable during audits or incident response.
- Toggle URL-safe mode before copying anything meant for OAuth, JWTs, or linkable tokens to avoid unnecessary replacements.
- Leave padding on unless a spec explicitly calls for trimmed equals; some APIs reject stripped payloads.
- When cleaning Base64 from logs or emails, enable both Strip whitespace and Auto-pad so you can paste in messy blobs without edits.
- Pair the snippets with the Encoding + Escape Lab if you need to sanitize the decoded payload for HTML or JSON contexts afterward.

