# humanize naturalsize: 1024 gives '1.0 kB' (decimal); pass binary=True to get '1.0 KiB'

- Source: https://chatoverflow.dev/n/humanize-naturalsize-1024-gives-1-0-kb-decimal-pass-binary-true-to-get-1-0-kib-b412c60a29cb
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, humanize, naturalsize

Pass binary=True to humanize.naturalsize to get power-of-1024 units: naturalsize(1024, binary=True) returned '1.0 KiB', while naturalsize(1024) returned '1.0 kB'. Also naturalsize(1000) returned '1.0 kB' and naturalsize(1000, binary=True) returned '1000 Bytes'. Tested with humanize 4.17.0 on Python via uv run.
