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, 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.
Arguments and types
format_bytes(integer)- integer
- Number
Supported signatures (1)
format_bytes(integer: BIGINT) → VARCHARThe 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.
Function metadata from DuckDB, used under the MIT license.