Generating ZK Proofs in the Browser: Tools and Tradeoffs
Three tools for browser-based ZK proof generation — snarkjs, halo2-wasm, and Noir — compared by proving time, memory usage, and proof size. What works today and what doesn't.
Generating zero-knowledge proofs in the browser is a requirement for privacy-preserving web applications. If the user's private data must not leave their device, the proof must be generated client-side. This rules out server-side proving and creates a set of constraints that browser-based ZK tools must navigate.
Three tools dominate browser-based ZK proof generation today: snarkjs, halo2-wasm, and Noir (with Barretenberg), as surveyed in our ZK proving systems comparison for 2026. Each has different tradeoffs in proving time, memory usage, proof size, and developer experience, which our ZK proving system decision framework covers at a higher level. This article compares them using information from their public documentation and repositories. No proprietary benchmarks are included.
The Browser Constraint
Before comparing tools, understand the environment. Browsers impose hard constraints on computation:
The 4GB WASM Memory Limit
WebAssembly is a 32-bit address space. The maximum linear memory is 4GB (65,536 pages of 64KB). The WebAssembly specification originally capped this at 2GB (32,767 pages), but the limit was raised to 4GB after requests from partners who needed larger memories. Chrome and Firefox support the 4GB limit on 64-bit systems.
In practice, the usable memory is less than 4GB. The WASM module itself, the JavaScript heap, and the browser's overhead consume address space. Realistic maximum WASM memory for ZK proving is approximately 2-3GB on most browsers.
This is the single biggest constraint. ZK proving is memory-intensive. The proving key, the witness, and intermediate data structures all consume memory. For large circuits, the WASM memory limit is the ceiling. The o1js team documented this directly: "WASM has served us well, but it comes with the 4GB linear-memory limit and a tedious internal conversion layer. In proving workflows, both matter: memory grows quickly with circuit size."
No Native Threads (Without Web Workers)
JavaScript is single-threaded. WASM modules run on the main thread by default, blocking the UI. For long-running computations like ZK proving, this freezes the browser tab.
Web Workers solve this by running code on a background thread. But Web Workers do not share memory by default — they communicate via message passing. SharedArrayBuffer enables shared memory between workers, but it requires specific HTTP headers (COOP and COEP) that not all hosting providers support.
Some WASM modules use wasm-bindgen-rayon to parallelize computation across Web Workers. halo2-wasm uses this approach. But it requires SharedArrayBuffer, which means your server must set Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp headers. If these headers are not set, multithreading falls back to single-threaded mode.
No GPU Access (Yet)
WebGPU is emerging as a browser API for GPU computation, but it is not universally supported and ZK tooling does not widely use it yet. All three tools discussed here run their proving logic on CPU via WASM.
Tool 1: snarkjs
snarkjs is a JavaScript and WASM implementation of zkSNARK protocols. It supports Groth16, PLONK, and FFLONK. It is the most widely used browser-based ZK tool, primarily because of its simplicity and its integration with circom, the most popular ZK circuit language.
Setup
snarkjs works in the browser by loading a bundled JavaScript file:
<script src="snarkjs.min.js"></script>
The bundle is copied from node_modules/snarkjs/build/snarkjs.min.js. No build step is required — just include the script.
Proof Generation
The core API is snarkjs.groth16.fullProve, which computes the witness and generates the proof in one step:
async function calculateProof() {
const { proof, publicSignals } =
await snarkjs.groth16.fullProve(
{ a: 3, b: 11 },
"circuit.wasm",
"circuit_final.zkey"
);
return { proof, publicSignals };
}
The function takes three arguments: the input object, the path to the circuit's WASM file (generated by circom), and the path to the proving key (.zkey file). It returns the proof and the public signals.
Verification
Verification uses the verification key:
const vkey = await fetch("verification_key.json").then(res => res.json());
const isValid = await snarkjs.groth16.verify(vkey, publicSignals, proof);
Characteristics
- Protocol — Groth16 (circuit-specific trusted setup), PLONK (universal trusted setup), FFLONK.
- Proof size — Groth16 produces the smallest proofs: approximately 192 bytes (3 group elements on BN254). PLONK produces approximately 576 bytes.
- Trusted setup — Groth16 requires a circuit-specific trusted setup ceremony. PLONK requires a universal setup (the Aztec Ignition ceremony).
- Multithreading — snarkjs uses Web Workers internally to parallelize computation. The underlying cryptography runs in WASM.
- Circuit language — circom. Circuits are written in a domain-specific language and compiled to WASM and R1CS.
Browser Considerations
snarkjs is the easiest tool to get running in the browser. The API is a single function call. The WASM file and proving key are loaded via fetch. No special HTTP headers are required for basic (single-threaded) operation.
The main limitation is circuit size. For circuits with millions of constraints, the proving key can be hundreds of megabytes, and the WASM memory usage during proving can exceed the 4GB limit. snarkjs is best suited for small to medium circuits (thousands to tens of thousands of constraints).
Tool 2: halo2-wasm
halo2-wasm is a WASM bindings package for the halo2 proving system, maintained by Axiom. It is part of the halo2-browser monorepo, which includes tools for using halo2 in-browser via WASM.
Setup
halo2-wasm is a Rust crate compiled to WASM. The setup is more involved than snarkjs:
import {
init,
initThreadPool,
initPanicHook,
Halo2Wasm,
MyCircuit,
} from "<IMPORT PATH>";
const main = async () => {
await init();
initPanicHook();
await initThreadPool(numThreads);
const halo2wasm = new Halo2Wasm();
const myCircuit = new MyCircuit(halo2wasm);
};
You must call init() to load the WASM module, initPanicHook() for error messages, and initThreadPool(numThreads) to enable multithreading. The circuit is defined in Rust using halo2-lib and compiled to a WASM bundle.
Proof Generation
After setting up the circuit, you run witness generation and proving:
myCircuit.run(); // Witness generation
halo2wasm.prove(); // Proof generation
The Halo2Wasm struct exposes operations: mock (mock prover for testing), keygen (proving key generation), prove (proof generation), and verify (proof verification).
Characteristics
- Protocol — Halo2 (PLONKish with IPA commitment scheme). No trusted setup.
- Proof size — Approximately 1.2KB for typical circuits. Larger than Groth16 but smaller than STARKs.
- Trusted setup — None. Halo2 uses recursive proof aggregation instead of a trusted setup ceremony.
- Multithreading — Uses
wasm-bindgen-rayonfor parallelism. Requires SharedArrayBuffer (COOP and COEP headers). When targeting Node.js (not browser), Rayon is disabled. - Circuit language — Rust with halo2-lib. Circuits are written in Rust and compiled to WASM. A TypeScript wrapper (
halo2-lib-js) allows writing circuits in JS/TS.
Browser Considerations
halo2-wasm is more complex to set up than snarkjs. You need a Rust toolchain to compile circuits to WASM, and you need a bundler (Webpack, Vite) configured for WASM and Web Workers. The COOP and COEP headers are required for multithreading.
The Zordle project (ZK Wordle) is one of the first known webapps built on halo2. The halo2 Book documents the WASM port using Zordle as a reference. The proving function takes advice and instance data, generates a complete witness, and outputs a proof. The verification function takes a proof and instance and returns a boolean.
A benchmark by ChainSafe tested Orchard (halo2) proof generation in-browser. The results: "Transaction Halo2 proofs were generated for various numbers of spends. Surprisingly this turned out to be an expensive operation with the proof generation for a non-trivial spend taking over a minute." The report notes it is unclear whether this is due to Halo2 proving failing to take advantage of multiple threads or poorly optimized WASM code. This is significantly longer than native proving.
The halo2-repl tool provides a browser-based REPL for writing halo2 circuits in TypeScript, powered by halo2-wasm and halo2-lib-js. This is useful for prototyping circuits before deploying them.
Tool 3: Noir (with Barretenberg)
Noir is a domain-specific language for ZK circuits, developed by Aztec. It compiles to an intermediate representation (ACIR) that can be executed by any proving backend. The default backend is Barretenberg, which has a WASM build (bb.js) that runs in the browser.
Setup
NoirJS and Barretenberg are imported as ES modules:
import { Barretenberg, UltraHonkBackend } from '@aztec/bb.js';
import { Noir } from '@noir-lang/noir_js';
import initNoirC from '@noir-lang/noirc_abi';
import initACVM from '@noir-lang/acvm_js';
import acvm from '@noir-lang/acvm_js/web/acvm_js_bg.wasm?url';
import noirc from '@noir-lang/noirc_abi/web/noirc_abi_wasm_bg.wasm?url';
import circuit from './target/circuit.json';
// Initialize WASM modules
await Promise.all([initACVM(fetch(acvm)), initNoirC(fetch(noirc))]);
Two WASM modules are loaded: the ACVM (ACIR virtual machine, for witness generation) and the Noir compiler ABI. The circuit is loaded from a JSON file generated by nargo compile.
Proof Generation
const noir = new Noir(circuit);
const barretenbergAPI = await Barretenberg.new();
const backend = new UltraHonkBackend(circuit.bytecode, barretenbergAPI);
// Generate witness
const { witness } = await noir.execute({ age: 18 });
// Generate proof
const { proof, publicInputs } = await backend.generateProof(witness);
The Noir class executes the circuit to produce a witness. The UltraHonkBackend generates the proof using Barretenberg's UltraHonk protocol. The backend can be configured with a threads parameter for parallelism.
Verification
const isValid = await backend.verifyProof({ proof, publicInputs, verificationKey });
Characteristics
- Protocol — UltraHonk (Plonkish with lookup tables). No trusted setup.
- Proof size — Variable, typically in the low kilobyte range. Larger than Groth16, comparable to Halo2.
- Trusted setup — None. Barretenberg uses a transparent setup.
- Multithreading — Barretenberg supports a
threadsparameter. The browser WASM build uses Web Workers for parallelism. - Circuit language — Noir. A high-level, Rust-like DSL that is easier to write than circom or raw halo2. Noir abstracts away constraint counting and witness generation.
Browser Considerations
Noir has the best developer experience of the three tools. The circuit language is high-level and readable. The JavaScript API is clean. The WASM modules are loaded via standard ES module imports with ?url suffixes for the WASM binary paths.
The main consideration is bundle size. The ACVM and Barretenberg WASM modules are large (tens of megabytes). For web applications, this means a significant initial load time. Lazy-loading the WASM modules (only when the user needs to prove) is a common pattern.
Aztec's architecture demonstrates the browser proving use case: private functions generate proofs client-side on the user's device, while public functions are proven by the rollup's prover. The Aztec team's documentation explains: "The proof of a private transaction's correct execution has to be generated client-side. That means that every Aztec network user should be able to generate a proof on their smartphone or laptop browser."
Comparison Summary
| Property | snarkjs | halo2-wasm | Noir (Barretenberg) |
|---|---|---|---|
| Protocol | Groth16 / PLONK | Halo2 (IPA) | UltraHonk |
| Trusted setup | Yes (circuit-specific for Groth16) | No | No |
| Proof size | ~192 bytes (Groth16) | ~1.2KB | Low KB range |
| Circuit language | circom | Rust (halo2-lib) / TS (halo2-lib-js) | Noir DSL |
| Multithreading | Web Workers | wasm-bindgen-rayon (needs COOP/COEP) | Web Workers |
| Setup complexity | Low | High | Medium |
| Best for | Small circuits, on-chain verification | Medium circuits, no-setup requirement | Developer experience, medium circuits |
Web Worker Patterns
All three tools benefit from running in a Web Worker to avoid blocking the main thread. The general pattern:
- Main thread — Handles UI, user input, and displays progress.
- Worker thread — Loads the WASM module, receives inputs via
postMessage, generates the proof, and sends the result back.
// main.js
const worker = new Worker("prove-worker.js");
worker.postMessage({ inputs, wasmPath, zkeyPath });
worker.onmessage = (e) => {
if (e.data.type === "progress") {
updateProgressBar(e.data.value);
} else if (e.data.type === "result") {
displayProof(e.data.proof);
}
};
// prove-worker.js
self.onmessage = async (e) => {
const { inputs, wasmPath, zkeyPath } = e.data;
const { proof, publicSignals } = await snarkjs.groth16.fullProve(
inputs, wasmPath, zkeyPath
);
self.postMessage({ type: "result", proof, publicSignals });
};
For halo2-wasm, the worker must call initThreadPool with the number of available threads. For Noir, the Barretenberg backend accepts a threads parameter.
Progress Reporting
ZK proving can take seconds to minutes. Without progress feedback, the user assumes the application is frozen. Unfortunately, none of the three tools expose granular progress callbacks during proving. The workaround is to report progress at coarser stages:
- "Loading WASM module..." — During WASM initialization.
- "Generating witness..." — Before proving starts.
- "Generating proof..." — During proving (no sub-progress available).
- "Done." — When the proof is returned.
What Works Today and What Doesn't
What Works
- Small circuits (under 100K constraints) — All three tools can generate proofs in reasonable time (seconds to low tens of seconds) for small circuits. snarkjs with Groth16 is the fastest for small circuits.
- On-chain verification — snarkjs with Groth16 produces proofs small enough (192 bytes) for economical on-chain verification. The
exportSolidityCallDatafunction generates calldata for Solidity verifier contracts. - Privacy-preserving web apps — All three tools can generate proofs client-side, keeping private inputs on the user's device.
- Prototyping — halo2-repl and Noir's high-level DSL make circuit prototyping fast.
What Doesn't Work (Yet)
- Large circuits (millions of constraints) — The 4GB WASM memory limit is a hard ceiling. Large circuits that work in native execution run out of memory in the browser. The o1js team's move to native Node.js proving was driven by this: "Chunking was often blocked by the 4GB linear-memory ceiling; in native Node, it becomes a reliable tool."
- Fast proving for complex circuits — The ChainSafe benchmark showed halo2 proving in-browser taking over a minute for non-trivial spends. This is significantly slower than native proving. Users will not wait minutes for a proof in a web app.
- Mobile browsers — Mobile devices have less memory and weaker CPUs than desktops. The 4GB WASM limit is even more constraining on mobile (many devices cannot allocate even 2GB to WASM). Mobile proving is limited to very small circuits.
- GPU acceleration — WebGPU is not yet widely supported by ZK tooling. All proving is CPU-based via WASM.
Summary
Browser-based ZK proof generation is practical for small to medium circuits. snarkjs is the easiest to integrate and produces the smallest proofs (Groth16). halo2-wasm offers no trusted setup but requires more setup complexity and COOP/COEP headers. Noir offers the best developer experience with its high-level DSL but has larger WASM bundles.
The 4GB WASM memory limit is the primary constraint. It caps circuit size and forces architectural decisions (circuit splitting, offloading to server, native fallback), which is one reason the choice of proving system matters so much for browser-based applications. Web Workers are necessary to avoid blocking the UI. Progress reporting is limited because the proving APIs do not expose granular progress.
For production applications, choose the tool based on your constraints: snarkjs for small circuits and on-chain verification, halo2-wasm for no-setup requirements, Noir for developer experience and medium circuits. For a broader comparison of proving systems beyond the browser, see our ZK proving system decision framework. All three are actively developed and their browser support is improving.
If you are building browser-based ZK applications, Orkid is one project working in this space. But the tools and tradeoffs described here are from public documentation and are applicable to any browser-based ZK project.
Frequently Asked Questions
Can ZK proofs run in the browser?
Yes, zero-knowledge proofs can be generated entirely in the browser using WebAssembly or WebGPU to execute the proving algorithm client-side. Several proving systems compile their prover code to WASM so it can run in a standard browser environment without native dependencies. Browser-based proving enables privacy-preserving applications where the user's witness data never leaves their device, since only the proof is transmitted. The main constraints are computation speed and memory, which are significantly more limited than a native server environment.
What is witness calculation?
Witness calculation is the process of computing all intermediate values in a zero-knowledge circuit given the public inputs and the prover's private inputs, producing the full witness vector that the prover needs to generate the proof. The witness is the complete assignment of all wires in the circuit, and it must satisfy every constraint defined by the circuit. This step is typically the most computationally expensive part of proof generation because it requires executing the entire circuit logic. In a browser context, witness calculation runs in WASM and can be a bottleneck for large circuits.
How long does browser proof generation take?
Browser proof generation time depends on the circuit size, the proving system, and the client device's hardware. Small circuits with a few thousand constraints can prove in under a second, while circuits with millions of constraints can take tens of seconds to several minutes in a browser. WASM execution is typically several times slower than native code, and the single-threaded nature of the main browser thread can further limit throughput. Web Workers can parallelize parts of the computation, and WebGPU can accelerate certain operations where supported.
What are the memory constraints?
Browser environments impose significantly tighter memory constraints than native applications, with practical limits on WASM linear memory and JavaScript heap size that vary by browser and device. Large circuits require substantial memory for the witness vector and proving keys, and exceeding available memory causes the tab to crash or the computation to fail. The 32-bit memory addressing of WASM in most browsers caps linear memory at approximately 4 GB, which limits the maximum circuit size. Strategies to manage memory include streaming witness generation, chunked proving, and circuit-specific optimizations that reduce key sizes.
What is a WASM-based ZK prover?
A WASM-based ZK prover is a zero-knowledge proving system whose prover code has been compiled to WebAssembly so it can execute in a browser or other WASM-compatible runtime without native installation. The proving system's arithmetic operations, polynomial commitments, and witness generation logic are all implemented in a language that compiles to WASM, such as Rust or C++. This allows web applications to generate proofs entirely client-side, preserving the privacy of the witness. The tradeoff is that WASM execution is slower and more memory-constrained than native execution, which limits the complexity of circuits that can be practically proven in the browser.
Put it to work
The research above powers the product — try it or compare it: