DEV Community

Cover image for Building the Fastest Base64 Library for React Native - Introducing react-native-turbo-base64
Alex
Alex

Posted on

Building the Fastest Base64 Library for React Native - Introducing react-native-turbo-base64

If you work with images, camera frames, blobs or crypto in React Native, you are probably using Base64 more than you think.

I discovered this the hard way while profiling a production React Native app. Base64 encoding and decoding kept showing up in hot paths and consuming noticeable CPU time. At first it felt surprising. Then it became obvious - Base64 sits right in the middle of many media and binary workflows.

That is when I decided to dig deeper.

After analyzing existing solutions, especially react-native-quick-base64, I realized there was still a lot of performance left on the table. Most apps do not feel it immediately, but when Base64 operations happen frequently or on large buffers, the cost becomes real.

So I built a new library from scratch focused purely on performance.

Meet react-native-turbo-base64 🚀

Why another Base64 library

This was not about rewriting something that already works. The goal was simple - push performance as far as possible for React Native workloads.

The library is implemented in C++ and exposed through JSI, which means:

  • No bridge overhead
  • No async hops between JS and native
  • Direct work with ArrayBuffers
  • Much less copying and allocation

In other words, the data stays where it should be and moves as little as possible.

What makes it fast

The implementation focuses on low level optimizations that matter in real mobile workloads:

  • Zero unnecessary memory copies
  • Cache-friendly lookup tables
  • Tight loops optimized for modern CPUs
  • Designed specifically for Hermes and React Native
  • Works directly with binary buffers instead of strings whenever possible

These changes may sound small individually, but together they create a big difference.

Benchmark results

Across multiple tests, react-native-turbo-base64 consistently achieved multiple times faster encoding and decoding compared to react-native-quick-base64.

This becomes especially noticeable when working with:

  • Camera frames
  • Image processing
  • Large files and uploads
  • Crypto and hashing pipelines
  • Heavy ArrayBuffer usage

Even small improvements in hot paths can translate into real battery and performance gains on mobile devices.

Drop-in replacement

If you are already using react-native-quick-base64, migrating should be straightforward. The API was designed to be familiar so you can switch with minimal effort.

Open source and feedback welcome

This project was born from real profiling and real bottlenecks. I would love feedback from developers who are pushing React Native performance or working with heavy media pipelines.

Repository: react-native-turbo-base64

If Base64 ever showed up in your profiler, this library is for you 🙂

Top comments (0)