---
title: Compress and decompress data with gzip
description: "Compress a `Uint8Array` with `Bun.gzipSync()` and decompress it with `Bun.gunzipSync()`."
sidebarTitle: Gzip compression
mode: center
---

Use `Bun.gzipSync()` to compress a `Uint8Array` with gzip.

```ts
const data = Buffer.from("Hello, world!");
const compressed = Bun.gzipSync(data);
// => Uint8Array

const decompressed = Bun.gunzipSync(compressed);
// => Uint8Array
```

---

See [Utils](/runtime/utils).
