Cryptography

ChaCha20 vs AES: Which Encryption Algorithm Is Better?

9 min read
By
ChaCha20 vs AES: Which Encryption Algorithm Is Better?

NovelCrypt

AES is the most widely used encryption algorithm in the world. It protects your web traffic, your files, your databases, and your messages. ChaCha20 is the challenger — faster in software, resistant to timing attacks, and adopted by TLS 1.3, Signal, and SSH. The question of which is "better" depends entirely on your hardware and platform. In the browser, the answer is clear. On mobile devices without hardware acceleration, the answer flips. Understanding why is a lesson in how hardware, software, and cryptography interact.

What Is AES

AES (Advanced Encryption Standard) is a block cipher adopted by NIST in 2001 as FIPS 197. It operates on 128-bit blocks and supports key sizes of 128, 192, and 256 bits. AES is the encryption standard for the U.S. government, approved by the NSA for Top Secret data at 256 bits.

AES is typically used in GCM (Galois/Counter Mode), which provides authenticated encryption — both confidentiality and integrity in one operation. AES-GCM is the cipher suite used in TLS 1.3, IPSec, and NovelCrypt's own encryption tools.

For a deep dive into AES-GCM specifically, read our AES-256-GCM explainer.

What Is ChaCha20

ChaCha20 is a stream cipher designed by Daniel J. Bernstein. It generates a keystream from a 256-bit key and a 96-bit nonce, then XORs the keystream with the plaintext. ChaCha20 is always paired with the Poly1305 message authentication code to provide authenticated encryption.

ChaCha20-Poly1305 is standardized in RFC 8439 and is one of the two mandatory cipher suites in TLS 1.3 (the other being AES-GCM). It is used by Signal, SSH, WireGuard, and Google's QUIC protocol.

For a comparison of stream and block cipher concepts, read our stream cipher vs block cipher guide.

Performance Comparison

The performance comparison between AES and ChaCha20 is not straightforward. It depends entirely on whether the CPU has hardware acceleration for AES.

### With Hardware AES (AES-NI)

All modern Intel and AMD processors include AES-NI instructions. ARM processors since the ARMv8 architecture (used in iPhones since 2013 and most Android phones since 2016) include Crypto Extensions for AES acceleration.

| Operation | AES-256-GCM (AES-NI) | ChaCha20-Poly1305 | Winner | | --- | --- | --- | --- | | 1 KB encryption | ~0.3 microseconds | ~0.5 microseconds | AES | | 1 MB encryption | ~200 microseconds | ~350 microseconds | AES | | 100 MB encryption | ~20 milliseconds | ~35 milliseconds | AES |

With hardware acceleration, AES-GCM is roughly 1.5-2x faster than ChaCha20-Poly1305. The margin is consistent across data sizes.

### Without Hardware AES (Software Only)

On older ARM devices (pre-2016), IoT devices, and some budget processors, AES runs in software without hardware acceleration. This is where ChaCha20 shines.

| Operation | AES-256-GCM (software) | ChaCha20-Poly1305 | Winner | | --- | --- | --- | --- | | 1 KB encryption | ~1.5 microseconds | ~0.5 microseconds | ChaCha20 | | 1 MB encryption | ~1,200 microseconds | ~350 microseconds | ChaCha20 | | 100 MB encryption | ~120 milliseconds | ~35 milliseconds | ChaCha20 |

Without hardware acceleration, ChaCha20-Poly1305 is roughly 3x faster than AES-256-GCM. The gap is significant for mobile applications, VPNs, and any system running on hardware without AES instructions.

### In the Browser

The browser performance picture is different from native code. The Web Crypto API provides native, hardware-accelerated AES-GCM. It does not provide ChaCha20 at all.

| Algorithm | WebCrypto Support | Performance | Practical Choice | | --- | --- | --- | --- | | AES-256-GCM | Yes (hardware-accelerated) | Very fast | Use this | | ChaCha20-Poly1305 | No | Requires JS polyfill (slow) | Avoid in browsers | | AES-256-CBC | Yes | Fast, but no authentication | Use GCM instead |

This is why NovelCrypt uses AES-256-GCM for all browser-based encryption. The WebCrypto API provides native hardware acceleration for AES, making it the fastest and most secure option. A JavaScript ChaCha20 implementation would be both slower and harder to audit than native AES-GCM.

You can test AES-GCM performance yourself with the AES text encryptor and the file encryptor.

Security Comparison

### Key Sizes and Security Levels

| Algorithm | Key Size | Security Level | Nonce Size | Nonce Reuse Impact | | --- | --- | --- | --- | --- | | AES-256-GCM | 256 bits | 256 bits | 96 bits | Catastrophic (leaks auth key) | | ChaCha20-Poly1305 | 256 bits | 256 bits | 96 bits | Catastrophic (leaks plaintext) |

Both provide 256 bits of security. Both require unique nonces for every encryption operation. Nonce reuse is catastrophic for both — but the failure modes differ slightly. With AES-GCM, nonce reuse leaks the authentication key, allowing an attacker to forge tags. With ChaCha20, nonce reuse leaks the XOR of two plaintexts, allowing direct plaintext recovery.

### Side-Channel Resistance

ChaCha20 has an inherent advantage in side-channel resistance. It uses only addition, rotation, and XOR operations — all constant-time on all CPUs. It does not use lookup tables, which means it is immune to cache-timing attacks.

AES uses S-box lookup tables in software implementations. Without hardware acceleration, these table lookups are variable-time depending on the table index, which can leak key material through cache timing. AES-NI eliminates this concern by performing the S-box operation in hardware, but software AES remains vulnerable.

### Nonce Management

Both algorithms require unique nonces, but their nonce management strategies differ:

- **AES-GCM:** Typically uses a 96-bit random nonce. The birthday bound for 96-bit nonces means that after approximately 2^48 encryptions with the same key, there is a significant chance of nonce collision. For most applications, this is not a concern, but high-volume systems must rekey before reaching this limit.

- **ChaCha20-Poly1305:** Uses a 96-bit nonce. The same birthday bound applies. However, some implementations (like XChaCha20-Poly1305) use an extended 192-bit nonce, which makes random nonce generation safe for practically unlimited messages.

For replay attack prevention, both algorithms' nonce requirements provide freshness guarantees.

TLS 1.3: Both Are Mandatory

TLS 1.3 made both AES-GCM and ChaCha20-Poly1305 mandatory-to-implement cipher suites. This means every TLS 1.3 implementation must support both. The client and server negotiate which to use based on preference and hardware capabilities.

| Platform | Default Preference | Reason | | --- | --- | --- | | Desktop Chrome/Firefox | AES-256-GCM | Has AES-NI | | Android Chrome | ChaCha20-Poly1305 | Many devices lack AES hardware | | iOS Safari | AES-256-GCM | Apple A-series has AES hardware | | Google servers | Both (client preference) | Supports hardware AES |

This negotiation is one of the elegant features of TLS 1.3. The protocol automatically selects the fastest cipher for the hardware, without the user or developer needing to know which is better.

When to Use AES-GCM

1. **Browser-based encryption.** The Web Crypto API provides hardware-accelerated AES-GCM. No ChaCha20 alternative exists natively.

2. **Server-side encryption on x86 hardware.** All modern Intel and AMD processors have AES-NI. AES-GCM is faster than ChaCha20.

3. **Mobile apps on modern devices.** iPhone processors (A7 and later) and recent Android processors have AES hardware acceleration.

4. **When you need the widest compatibility.** AES is supported everywhere — every TLS library, every crypto framework, every hardware security module.

5. **When you want the most analyzed cipher.** AES has been analyzed by the cryptographic community for over 20 years with no practical attacks found. It is the most scrutinized cipher in history.

When to Use ChaCha20-Poly1305

1. **Mobile and IoT devices without AES hardware.** On ARM Cortex-A53, Cortex-A7, and other processors without Crypto Extensions, ChaCha20 is 3x faster.

2. **When side-channel resistance is critical.** If you cannot guarantee hardware AES and are running in an environment where timing attacks are a concern (shared hosting, multi-tenant clouds), ChaCha20's constant-time implementation is safer.

3. **VPN protocols.** WireGuard uses ChaCha20-Poly1305 as its only cipher. OpenVPN supports it as an option. VPN traffic is high-volume and benefits from ChaCha20's software performance.

4. **When you need extended nonces.** XChaCha20-Poly1305 provides a 192-bit nonce, making random nonce generation safe for unlimited messages without tracking state.

5. **When you want a simpler implementation.** ChaCha20 is a single algorithm with no mode of operation to choose. AES requires choosing a mode (GCM, CBC, CTR) and implementing it correctly.

Why Not Use Both?

Some systems use both AES and ChaCha20 for different purposes. For example:

- **TLS 1.3:** Uses whichever cipher the negotiation selects. - **Signal protocol:** Uses AES-GCM for some operations and ChaCha20 for others. - **WireGuard:** Uses ChaCha20-Poly1305 exclusively for simplicity.

NovelCrypt uses AES-256-GCM exclusively because all encryption happens in the browser, where WebCrypto provides hardware-accelerated AES. For symmetric encryption, the choice between AES and ChaCha20 is less important than using the algorithm correctly: unique nonces, authenticated encryption, and secure key generation.

A Decision Framework

``` Encrypting in a browser? → AES-256-GCM (WebCrypto, hardware-accelerated)

Encrypting on a server with AES-NI? → AES-256-GCM

Encrypting on a mobile device with AES hardware? → AES-256-GCM

Encrypting on a device without AES hardware? → ChaCha20-Poly1305

Building a VPN or high-throughput software encryption? → ChaCha20-Poly1305 (unless you know AES-NI is available)

Need side-channel resistance without hardware AES? → ChaCha20-Poly1305

Want the simplest possible implementation? → ChaCha20-Poly1305 (single algorithm, no mode selection)

Want maximum compatibility? → AES-256-GCM ```

The Bottom Line

AES and ChaCha20 are both excellent, well-analyzed, and secure. The choice between them is primarily a performance decision driven by hardware. In the browser, AES-256-GCM is the clear winner thanks to WebCrypto's hardware acceleration — which is why NovelCrypt uses it for all encryption. On devices without AES hardware acceleration, ChaCha20-Poly1305 is 3x faster and is the right choice. TLS 1.3 wisely made both mandatory, allowing each connection to use the faster option for its hardware. The one rule that applies to both: always use unique nonces, always use authenticated encryption (GCM or Poly1305), and never reuse keys without rekeying. For browser-based encryption, try the AES text encryptor and file encryptor — both use AES-256-GCM with hardware acceleration via the Web Crypto API.

Frequently Asked Questions

Is ChaCha20 faster than AES?

It depends on the hardware. On CPUs with AES-NI hardware acceleration (all modern Intel and AMD processors, and ARM processors with Crypto Extensions), AES-GCM is faster than ChaCha20. On CPUs without AES hardware acceleration (older ARM devices, some IoT devices), ChaCha20 is significantly faster — often 3x faster than software AES.

Why does not WebCrypto support ChaCha20?

The Web Crypto API was designed around algorithms with hardware support and broad implementation consensus. AES-GCM has hardware acceleration on essentially all modern devices, making it the performance winner in browsers. ChaCha20 was not included because AES-GCM already meets the performance and security requirements for browser encryption.

Is ChaCha20 more secure than AES?

Both are considered secure with no known practical attacks. ChaCha20 uses 256-bit keys and provides 256 bits of security. AES-256 also provides 256 bits of security. ChaCha20 has an advantage in resistance to timing attacks because it does not use lookup tables, while AES implementations must take care to use constant-time S-box operations.

Does TLS 1.3 use ChaCha20?

Yes. TLS 1.3 supports both AES-256-GCM and ChaCha20-Poly1305 as cipher suites. Clients can prefer either. Google Chrome and Android typically prefer ChaCha20-Poly1305 because many Android devices lack AES hardware acceleration. Desktop browsers typically prefer AES-GCM.

Try NovelCrypt Tools

Experience military-grade encryption for your sensitive data. Create self-destructing messages, encrypt files, or explore our experimental lab tools.

Explore NovelCrypt