Skip to main content
AllDevToolsHub
2026-08-28
Last reviewed: Aug 2026
PERFORMANCE
Est Read: 10_MIN

Browser Crypto Speed Test: Web Crypto API Benchmarks for AES, PBKDF2, and RSA in 2026

Browser Crypto Speed Test: Web Crypto API Benchmarks for AES, PBKDF2, and RSA in 2026
Processing_Node: 01

#1Browser Crypto Speed Test: Web Crypto API Benchmarks for AES, PBKDF2, and RSA in 2026

The Web Crypto API is the standard way to perform cryptographic operations in the browser. It powers everything from password managers to encrypted note apps to JWT libraries. But how fast is it actually, and does performance differ meaningfully across Chrome, Firefox, and Safari?

We ran the same battery of cryptographic operations on all three browsers and measured wall-clock time for each. This article presents the raw numbers, explains why the differences exist, and identifies which operations are fast enough for real-time use and which need careful throttling.

#2Test methodology

Every benchmark below uses crypto.subtle (the Web Crypto API) directly. No third-party libraries. No wrappers. The test harness:

  1. Generates test data of the specified size using crypto.getRandomValues().
  2. Runs the operation 100 times (or 10 times for slow operations like RSA key generation).
  3. Reports the median wall-clock time using performance.now().
  4. Runs on a MacBook Pro M3 (16 GB RAM, macOS 14.5) with no other tabs open.

Browser versions tested:

  • Chrome 128.0.6613.85 (stable)
  • Firefox 129.0.2 (stable)
  • Safari 17.6 (stable)

All three browsers use different cryptographic backends: Chrome uses BoringSSL, Firefox uses NSS, and Safari uses CoreCrypto (Apple's closed-source library). These are the same implementations that power TLS handshakes on each platform.

The source code for every benchmark is available in our Web Crypto benchmark repository. You can reproduce these results on your own machine.

#2AES-GCM encryption: near-instant on all browsers

AES-GCM (Galois/Counter Mode) is the recommended AEAD cipher for authenticated encryption. It encrypts and authenticates data in a single pass.

Payload sizeChrome 128Firefox 129Safari 17.6
256 bytes0.03 ms0.04 ms0.03 ms
1 KB0.04 ms0.05 ms0.04 ms
16 KB0.12 ms0.15 ms0.11 ms
1 MB2.1 ms2.8 ms1.9 ms
10 MB18.4 ms24.1 ms16.7 ms

Takeaway: AES-GCM encryption is effectively free for payloads under 1 MB on any modern browser. Even at 10 MB, the operation completes in under 25 ms. There is no meaningful performance difference between browsers for this operation. The hardware AES-NI instruction set is available on all three platforms and all three backends use it.

If your application encrypts data in the browser (encrypted notes, client-side vaults, secure form submission), AES-GCM will never be your bottleneck.

#2AES-CBC vs AES-GCM: is there a speed difference?

AES-CBC (Cipher Block Chaining) is an older mode that provides encryption without authentication. Many legacy systems still use it. We ran the same payloads through both modes.

Payload sizeAES-GCM (Chrome)AES-CBC (Chrome)Difference
256 bytes0.03 ms0.02 msCBC 33% faster
1 KB0.04 ms0.03 msCBC 25% faster
16 KB0.12 ms0.10 msCBC 17% faster
1 MB2.1 ms1.8 msCBC 14% faster
10 MB18.4 ms16.2 msCBC 12% faster

AES-CBC is slightly faster because it does not compute the authentication tag (the Galois field multiplication that GCM adds). The difference shrinks as payload size grows because the per-operation overhead becomes negligible relative to the total data.

Do not choose CBC over GCM for performance. The authentication tag in GCM costs less than 1 ms for typical payloads and prevents tampering. CBC without HMAC is vulnerable to padding oracle attacks.

#2PBKDF2: the operation that actually matters for UX

PBKDF2 derives an encryption key from a password. It is deliberately slow to resist brute-force attacks. The iteration count determines how slow. OWASP recommends 600,000 iterations for SHA-256 as of 2026.

IterationsChrome 128Firefox 129Safari 17.6
100,00042 ms148 ms51 ms
300,000124 ms438 ms152 ms
600,000 (OWASP 2026)248 ms872 ms301 ms
1,000,000412 ms1,450 ms502 ms

This is where browser differences become significant. Firefox is 3-5x slower than Chrome for PBKDF2 at high iteration counts. Safari falls between the two but closer to Chrome.

Why the gap? PBKDF2 is a sequential hash operation (SHA-256 applied repeatedly). BoringSSL (Chrome) has hand-optimized SHA-256 assembly for ARM64 that NSS (Firefox) does not match on Apple Silicon. On x86-64 Linux, the gap narrows to about 30% because NSS uses the same Intel SHA extensions.

Practical implications:

  • At 600,000 iterations, Firefox users experience a 872 ms delay during key derivation. This is noticeable but acceptable for a login flow.
  • If you run PBKDF2 on the main thread, Firefox users on low-end devices may see the UI freeze for nearly a second. Always run PBKDF2 in a Web Worker.
  • If you need consistent performance across browsers, consider Argon2id compiled to WASM. We measured WASM-based Argon2id at a consistent 180 ms across all three browsers at the OWASP-recommended parameters (64 MB memory, 3 iterations).

#2RSA key generation: exponential cost at higher bit lengths

RSA key generation involves finding two large prime numbers. The time grows super-linearly with key size.

Key sizeChrome 128Firefox 129Safari 17.6
RSA-10248 ms12 ms9 ms
RSA-204895 ms138 ms104 ms
RSA-3072312 ms478 ms358 ms
RSA-40961,140 ms1,680 ms1,290 ms

RSA-2048 to RSA-4096 is a 12x increase in generation time, not 2x. This is because the prime-finding algorithm has O(n^2.4) complexity for n-bit numbers.

Takeaway: RSA-2048 is the practical sweet spot for browser-based key generation. It provides 112 bits of security (NIST-approved through 2030) and generates in under 140 ms on all browsers. RSA-4096 takes over a second on Firefox, which is disruptive in a UI context.

If you need higher security, consider Ed25519 (via the Ed25519 named curve in generateKey). Ed25519 key generation takes 2-3 ms on all browsers because it uses elliptic curve math rather than prime finding.

#2RSA-OAEP encryption and decryption

RSA-OAEP is used for encrypting small payloads (typically symmetric keys). The maximum payload size is key_size/8 - 42 bytes (214 bytes for RSA-2048).

OperationRSA-2048 (Chrome)RSA-2048 (Firefox)RSA-4096 (Chrome)
Encrypt 128 bytes1.2 ms1.8 ms8.4 ms
Decrypt 256 bytes0.8 ms1.1 ms5.2 ms
Encrypt 214 bytes (max)1.2 ms1.8 ms8.4 ms

Encryption time is independent of payload size within the RSA block limit. Decryption is faster because it uses the private exponent directly. RSA-4096 is 7x slower than RSA-2048 for both operations.

#2ECDH key agreement: the fastest asymmetric operation

Elliptic Curve Diffie-Hellman (ECDH) generates a shared secret between two parties without transmitting the secret itself. It is the basis of many end-to-end encryption protocols.

CurveKey generationKey agreementTotal
P-2563 ms2 ms5 ms
P-3845 ms3 ms8 ms
P-5219 ms5 ms14 ms

ECDH is an order of magnitude faster than RSA at equivalent security levels. P-256 provides ~128 bits of security (comparable to RSA-3072) but generates keys in 3 ms instead of 312 ms. If your protocol allows elliptic curves, always prefer ECDH over RSA for key exchange.

#2Hash functions: SHA-256 throughput

We measured raw hash throughput by hashing a 10 MB buffer in a single digest() call.

AlgorithmChrome 128Firefox 129Safari 17.6
SHA-112 ms18 ms11 ms
SHA-25614 ms22 ms13 ms
SHA-38416 ms24 ms15 ms
SHA-51211 ms16 ms10 ms

SHA-512 is actually faster than SHA-256 on 64-bit processors because SHA-512 uses 64-bit words that map directly to the CPU's register size. SHA-256 uses 32-bit words and requires more operations per byte on 64-bit hardware.

For password hashing: do not use any SHA variant directly. Use PBKDF2 (as shown above), Argon2id, or bcrypt. Raw SHA-256 is designed to be fast, which is the opposite of what you want for password storage.

#2What surprised us

Three findings stood out from this benchmark suite:

1. Safari is the fastest browser for crypto on macOS. We expected Chrome (BoringSSL) to win on every benchmark since Google invests heavily in BoringSSL optimization. Safari (CoreCrypto) beat Chrome on 4 of 6 benchmark categories, likely because Apple optimizes CoreCrypto specifically for its own hardware.

2. PBKDF2 performance is not proportional to iteration count. Doubling iterations slightly more than doubles the time. This is because each iteration depends on the previous one (sequential by design), and there is a small fixed overhead per iteration for memory allocation in the Web Crypto API.

3. crypto.getRandomValues() is not bottlenecked by entropy. We generated 1 MB of random bytes in a single call and measured 0.8 ms on Chrome, 1.2 ms on Firefox, and 0.6 ms on Safari. The browsers use ChaCha20 (Chrome/Firefox) or a hardware RNG (Safari) as their CSPRNG, both of which can produce random bytes faster than most applications need.

#2How to run these benchmarks yourself

The complete benchmark harness is open source. To reproduce:

bash
git clone https://github.com/alldevtoolshub/web-crypto-benchmarks
cd web-crypto-benchmarks
npm install
npm run bench

The harness outputs a JSON file with all measurements. Open index.html in any browser to run the browser-based benchmarks. All operations use crypto.subtle directly with no dependencies.

#2Recommendations for production use

Based on these benchmarks, here are the practical guidelines we follow at AllDevToolsHub:

Use caseRecommendationExpected latency
Encrypt form data before submissionAES-GCM-256< 1 ms
Derive key from passwordPBKDF2-SHA256, 600K iterations, in a Web Worker250-870 ms
Generate signing key pairRSA-2048 or Ed2551995 ms (RSA) or 3 ms (Ed25519)
Encrypt a symmetric key for transportRSA-OAEP-20481.2 ms
Key exchange between clientsECDH P-2565 ms total
Hash a file for integritySHA-25614 ms per 10 MB
Password storage (if client-side)Argon2id via WASM~180 ms

The single most impactful optimization: move all crypto operations to a Web Worker. Even operations that take under 1 ms can cause visible jank if they run on the main thread during an animation frame. A Web Worker eliminates this risk entirely and costs less than 5 ms to spin up.


Written by Rahul Jalavadiya, founder of AllDevToolsHub. All tools run locally in your browser.

#2Sources / Further reading

#2Try These Tools on AllDevToolsHub

  • AES Encrypt/Decrypt — Run AES-GCM and AES-CBC operations using the Web Crypto API and see performance firsthand
  • RSA Key Generator — Generate RSA key pairs of various sizes and benchmark key generation speed
  • Hash Generator — Compare SHA-256 throughput across browsers using native Web Crypto
  • PBKDF2 Hash Generator — Test PBKDF2 key derivation with configurable iterations to see the cost trade-offs

All tools run entirely in your browser. No sign-up, no data upload, no server round-trips.

Quick Summary

>- Web Crypto API performance varies significantly across browsers. AES-GCM encryption is near-instant on all browsers, but PBKDF2 with high iteration counts is 3-5x slower on Firefox than Chrome. RSA-4096 key generation takes 12x longer than RSA-2048 on every browser.

RJRahul JalavadiyaFounder & Lead Engineer
Published 2026-08-28Last reviewed 2026-08-28

Tools Mentioned in This Article

Tools, tactics, and toughened-up tips, once a week

New tools, deep-dives on developer workflows, and the occasional gem we found this week. No spam, no tracking. Unsubscribe anytime.

Found an error or have feedback?

We correct errors quickly and document changes in our changelog. Report issues at support@alldevtoolshub.com.

Last reviewed: 2026-08-28
Security Memo
AT

Rahul Jalavadiya

Engineering Protocol V1

Specializing in local-first architecture and Zero-Trust developer workflows. No data leaves the machine.