DevToolsHub

Base64 Encoder & Decoder

Encode or decode Base64 for data URLs, MIME attachments, and embedded blobs in JSON. Remember: Base64 is encoding, not encryption—anyone can reverse it.

File upload and download help you round-trip small binaries without a local CLI.

How to use

  1. Encode: Enter text and click Encode to Base64, or use "Choose file" to encode a file.
  2. Decode: Paste a Base64 string and click Decode to text, or Download as file for binary data.
  3. Use Share URL to create a link with your data (?data= for text, ?encoded= for Base64).
  4. Use Copy to copy the result to the clipboard.

1What Base64 is actually doing

Base64 represents binary data using a small alphabet of letters, digits, and a couple of symbols so it can travel through systems that only handle text safely.

You will see it in data URLs, email MIME parts, certain authentication headers, and when APIs embed small images or certificates as strings.

  • Encoding is not encryption: anyone can decode Base64, so never treat it as a way to hide sensitive information.
  • URL-safe variants swap characters like + and / so values fit cleanly inside query strings and path segments.

2Practical workflows

Developers often decode a chunk from a log line to confirm it matches the original file, or encode a small binary blob to paste into a test harness.

When you work with files, prefer verifying the byte size and a checksum after round-tripping encode and decode to ensure nothing was corrupted in transit.

3Tips for fewer mistakes

Strip whitespace and line breaks from pasted strings if a decode fails—some copy sources add hidden characters.

If you are embedding in JSON, remember that JSON strings need escaping; decoding the inner Base64 first can make nested structures easier to read.

4Where Base64 appears in real systems

Email attachments use MIME encoding. JWT segments are Base64url. Some databases store small binaries as text columns. Data URLs embed images directly in HTML or CSS for icons and thumbnails.

When debugging, developers often copy a Base64 chunk from a log, decode it locally, and compare the result to the expected file hash.

5Padding, line breaks, and URL-safe variants

Standard Base64 may end with one or two `=` padding characters. URL-safe variants replace `+` and `/` so values survive query strings without extra escaping.

Pasted strings from PDFs or chat apps sometimes include line breaks every 76 characters; strip whitespace if decode fails unexpectedly.

6Quick checklist for Base64 workflows

Confirm whether padding characters are required for your target system. After decoding binary output, compare file size and a hash against the source when integrity matters.

  • Remember encoding is not encryption.
  • Strip line breaks from pasted strings if decode fails unexpectedly.

Examples

Encode plain text

The string "Hello" encodes to the value below (standard alphabet).

SGVsbG8=

Decode to inspect

Paste an encoded header value from a log to see the underlying JSON or binary metadata.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

Frequently asked questions

Is Base64 encryption?
No. Base64 is an encoding scheme anyone can reverse. Never use it to hide passwords, API keys, or personal data.
Why does decode fail on a valid-looking string?
Check for extra spaces, line breaks, URL-safe alphabet differences, or missing padding. Copy from PDFs and chat apps often adds hidden characters.
Can I encode files?
Yes. Upload a file to encode to Base64, or paste Base64 to decode and download the binary result. Verify file size and hash after round-trip for integrity.
What is URL-safe Base64?
It replaces + and / with characters safe in URLs and often omits padding. JWTs and some APIs use this variant.
Does this tool work offline?
After the page loads, encode and decode work without network access until you reload.