Production-grade · Apache 2.0

A better compressed bitset

Roaring bitmaps are compressed bitmaps that combine the speed of uncompressed bitsets with the memory efficiency of compression — often hundreds of times faster than older formats.

13+ language bindings 40+ contributors Apache 2.0 license
roaring.example
// Java — RoaringBitmap
import org.roaringbitmap.RoaringBitmap;

RoaringBitmap a = RoaringBitmap.bitmapOf(1, 2, 3, 1000);
RoaringBitmap b = RoaringBitmap.bitmapOf(2, 3, 4, 1000);

RoaringBitmap c = RoaringBitmap.and(a, b);
System.out.println(c.getCardinality()); // 3
// C++ — CRoaring
#include "roaring/roaring.hh"
using roaring::Roaring;

Roaring a = Roaring::bitmapOf(4, 1, 2, 3, 1000);
Roaring b = Roaring::bitmapOf(4, 2, 3, 4, 1000);

Roaring c = a & b;
std::cout << c.cardinality() << std::endl;
// Go — roaring
import "github.com/RoaringBitmap/roaring/v2"

a := roaring.BitmapOf(1, 2, 3, 1000)
b := roaring.BitmapOf(2, 3, 4, 1000)

c := roaring.And(a, b)
fmt.Println(c.GetCardinality())
# Python — PyRoaringBitMap
from pyroaring import BitMap

a = BitMap([1, 2, 3, 1000])
b = BitMap([2, 3, 4, 1000])

print(len(a & b))  # 3
Why Roaring

Compressed bitsets, without the trade-offs

Roaring bitmaps combine the speed of uncompressed bitsets with the memory efficiency of compression — and consistently outperform older formats like WAH, EWAH, and Concise.

Fast by design

Random access in constant time. Set operations are implemented as native bitwise AND/OR/ANDNOT on dense chunks — often hundreds of times faster than run-length-encoded alternatives.

Adaptive storage

Each 65 536-integer chunk picks the best container — array, bitmap, or run — so dense, sparse, and clustered data are all encoded efficiently and without manual tuning.

Portable format

A published serialization specification means bitmaps written by one implementation can be read by any other — across Java, C, Go, Rust, Python, and more.

Battle-tested at scale

Powering YouTube's SQL engine, Apache Lucene, Druid, Spark, ClickHouse, Elasticsearch, Pinot, and dozens more — handling billions of operations daily.

Backed by research

Published in Software: Practice and Experience and recommended by independent benchmarking studies. Read the papers.

Open community

Apache 2.0 licensed. Developed in the open on GitHub by 40+ contributors across academia and industry. Discussion happens on the user group.

Use Roaring for bitmap compression whenever possible. Do not use other bitmap compression methods.
Trusted in production

Used by the systems you already know

Roaring is a building block in many of the world's most popular databases, search engines, and analytics platforms.

See the full list and case studies →

Get started in seconds

Add Roaring to your favorite language — the API is small, the format is portable, and the performance is uncompromising.