For Developers

Everything on this site runs in the browser: files are decoded locally and never uploaded, so there is no API key, no rate limit and nothing to sign up for. Below are the exact calls the tool uses — copy them into your own project, or open DevTools on any page here and read the source.

  • No upload: the file never leaves the machine it is opened on
  • No API key, no quota, no account
  • Browser text: TextDecoder over atob bytes — not bare atob
  • Node: Buffer.from(value, "base64")
  • Type detection: read the magic bytes, do not trust the extension
b64file — converter · local

Processed as you paste — no button to press (Ctrl+Enter converts now / Esc clears)

Paste, drag and drop, or Ctrl+V a screenshot

[01]

Decode text (browser)

function decodeBase64Text(value) {
  const clean = value.replace(/^data:[^;]+;base64,/, '').replace(/\s+/g, '');
  const standard = clean.replace(/-/g, '+').replace(/_/g, '/');
  const padded = standard + '='.repeat((4 - (standard.length % 4)) % 4);
  const bytes = Uint8Array.from(atob(padded), (c) => c.charCodeAt(0));
  return new TextDecoder('utf-8').decode(bytes);
}

Three details that break naive implementations: strip the data: prefix, normalise the URL-safe alphabet, restore the padding. Bare atob on UTF-8 text returns mojibake — see the JavaScript guide.

[02]

Decode to bytes, not text

If the payload is a file, never go through a string. Convert straight to a typed array and build a Blob:

function decodeBase64Bytes(value) {
  const clean = value.replace(/^data:[^;]+;base64,/, '').replace(/\s+/g, '');
  const bin = atob(clean);
  const bytes = new Uint8Array(bin.length);
  for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
  return bytes;
}

const blob = new Blob([bytes], { type: mime });
const url = URL.createObjectURL(blob);

In Node the same thing is one line: Buffer.from(value, 'base64') — and pass that buffer straight to fs.writeFile, without a UTF-8 round trip.

[03]

Detect the file type from magic bytes

An extension is a claim; the first bytes are evidence. This is the check this site runs before it offers a download:

const SIGNATURES = [
  { mime: 'image/png',  ext: 'png',  bytes: [0x89, 0x50, 0x4e, 0x47] },
  { mime: 'image/jpeg', ext: 'jpg',  bytes: [0xff, 0xd8, 0xff] },
  { mime: 'image/webp', ext: 'webp', bytes: [0x52, 0x49, 0x46, 0x46], also: { at: 8, bytes: [0x57, 0x45, 0x42, 0x50] } },
  { mime: 'application/pdf', ext: 'pdf', bytes: [0x25, 0x50, 0x44, 0x46] },
  { mime: 'font/woff2', ext: 'woff2', bytes: [0x77, 0x4f, 0x46, 0x32] },
  { mime: 'application/zip', ext: 'zip', bytes: [0x50, 0x4b, 0x03, 0x04] }
];

function matches(bytes, sig) {
  if (!sig.every((b, i) => bytes[i] === b)) return false;
  if (!sig.also) return true;
  return sig.also.bytes.every((b, i) => bytes[sig.also.at + i] === b);
}

const type = SIGNATURES.find((s) => matches(bytes, s.bytes)) ?? null;

WebP is the one that needs the second check: RIFF alone could be WAV or AVI, and only the marker at offset 8 tells them apart.

[04]

Large files without freezing the page

Decoding happens on the main thread unless you move it. For files above a few megabytes, a worker keeps the UI responsive:

const worker = new Worker('/b64-worker.js');
worker.postMessage({ base64 });
worker.onmessage = (e) => {
  const bytes = new Uint8Array(e.data.buffer);
  // ...
};

Two more traps: String.fromCharCode(...bytes) overflows the argument limit on large inputs (loop instead), and FileReader.readAsDataURL is convenient but materialises the whole Base64 string in memory — for very large files, read as an ArrayBuffer and encode in chunks.

[05]

What this site does and does not offer

Offers: client-side conversion for any file up to 100 MB, the same code paths documented above, and a documented list of what it recognises — see the decoder.

Does not offer: a hosted HTTP API. There is no endpoint to call, because the design goal is that your file never leaves your machine. If you need server-side conversion, the functions above run unchanged in Node, Bun or a Cloudflare Worker.

Frequently asked questions

Is there a JSON API endpoint?

No. Adding one would mean uploading the file to a server, which is the thing this site exists to avoid. The code on this page can be deployed to your own worker in an afternoon.

Can I use these snippets commercially?

Yes — they are ordinary standard-library calls with no licensing attached. Attribution is not required.

Why does the tool cap files at 100 MB?

Browser memory. The Base64 string, the decoded bytes and the Blob can coexist briefly, so a 100 MB file can need several hundred megabytes of headroom while it is being processed.

How do I know nothing is uploaded?

Open DevTools → Network, switch to the Fetch/XHR filter and paste a file. No request carries the payload. The site is a static bundle; there is no backend to receive it.

Related tools and guides