---
title: "format_bytes function in Strata | Oplema"
description: "Convert a byte count to a readable size using units based on powers of 2, such as KiB, MiB and GiB. For example, format_bytes(16_000) returns '15.6 KiB'."
url: "https://oplema.com/docs/strata/functions/format-bytes"
updated: "2026-11-04"
---

# format\_bytes

Convert a byte count to a readable size using units based on powers of 2, such as KiB, MiB and GiB. Also available as pg\_size\_pretty.

Also available as formatReadableSize.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

### Expression

```
format_bytes(16_000)
```

### Result

```
'15.6 KiB'
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 15.6 KiB |

## Arguments and types

```
format_bytes(integer)
```

**integer**

Number

Supported signatures (1)

```
format_bytes(integer: BIGINT) → VARCHAR
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[array\_extract

Get one item from a list or one character from text by position, where 1 is the first. For a struct, choose a field by name, or by position in an unnamed struct.

](https://oplema.com/docs/strata/functions/array-extract)[bin

Converts the string to binary representation.

](https://oplema.com/docs/strata/functions/bin)[hex

Convert a value to hexadecimal text.

](https://oplema.com/docs/strata/functions/hex)[unbin

Converts a value from binary representation to a blob.

](https://oplema.com/docs/strata/functions/unbin)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#format_bytesinteger)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
