Cryptography Utilities

Base64 to ArrayBuffer Converter

Instantly translate between Base64 strings and raw ArrayBuffer (Hex) formats required for native Web Crypto API integrations.

100% Client-Side

Your data never leaves the browser. We perform all binary conversions locally via JavaScript.

Web Crypto Ready

Generate pure Hex strings that map directly into Uint8Arrays for crypto.subtle operations.

Bidirectional Engine

Instantly convert Base64 payloads to Hex, or encode your raw Hex buffers back into transportable Base64.

Manual Cryptography is Dangerous.

Mishandling ArrayBuffers or hard-coding transport logic is the #1 cause of data leaks. ZeroKey automates client-side AES-GCM encryption, Base64 encoding, and database hard-deletes so you never have to worry about the plumbing.

Automate Your Security

Why Convert Base64 to ArrayBuffer?

If you are building a secure application using the Web Crypto API, you will immediately run into a data formatting problem. Native cryptographic functions like crypto.subtle.encrypt() strictly require data to be passed as a BufferSource (typically an ArrayBuffer or Uint8Array).

However, you cannot easily store raw binary ArrayBuffers in a PostgreSQL database, transmit them inside JSON payloads, or append them to URL fragments. To transport ciphertext across the internet, you must encode the raw binary into a Base64 String. This tool helps developers test their encoding and decoding logic visually.

How to convert Base64 to Uint8Array in JavaScript

You cannot use the standard `TextEncoder` for this. You must decode the Base64 string into binary characters, and then map those characters into a typed array. Here is the vanilla JavaScript approach:

base64-to-buffer.js
function base64ToArrayBuffer(base64) {
    const binaryString = window.atob(base64);
    const len = binaryString.length;
    const bytes = new Uint8Array(len);
    for (let i = 0; i < len; i++) {
        bytes[i] = binaryString.charCodeAt(i);
    }
    return bytes.buffer;
}

How to convert ArrayBuffer to Base64

Conversely, once the Web Crypto API encrypts your payload, it outputs an ArrayBuffer. Convert that buffer back into a Base64 string before sending your POST request:

buffer-to-base64.js
function arrayBufferToBase64(buffer) {
    let binary = '';
    const bytes = new Uint8Array(buffer);
    const len = bytes.byteLength;
    for (let i = 0; i < len; i++) {
        binary += String.fromCharCode(bytes[i]);
    }
    return window.btoa(binary);
}

Frequently Asked Questions

Why do I need to convert Base64 to ArrayBuffer?
Cryptographic functions in the Web Crypto API strictly require data to be passed as a BufferSource (ArrayBuffer or Uint8Array). To transport this data across the internet (via JSON or URLs), it must be encoded into a text-safe Base64 String.
Is this Base64 conversion secure and private?
Yes. This tool runs 100% client-side using JavaScript in your browser. No strings, hex codes, or payloads are ever transmitted to a server, ensuring your cryptographic data remains entirely private.

Privacy First

We use essential cookies & analytics strictly to improve our free tools. No PII or cryptography secrets are ever tracked.

Policy