Converts a number or numeric string into a human-readable byte-size string (for example, 825399 → 825.39 kB). You can also control the number of decimal places with the optional precision parameter.
{{bytes input precision}}
-
input (required): number or string representing a byte value
-
precision (optional): decimal rounding (defaults to 2)
-
Convert different values to formatted sizes
{{bytes record.a}} {{bytes record.b}} {{bytes record.c}} {{bytes record.d}}Input:
{ "record": { "a": "foo", "b": 13661855, "c": 825399, "d": 1396 } }Output:
3 B 13.66 MB 825.39 kB 1.4 kB
-
Using precision control
{{bytes record.b 0}} {{bytes record.b 3}}Input:
{ "record": { "b": 13661855 } }Output:
14 MB 13.662 MB
Tip
-
If the input is not numeric (for example,
"foo"), the helper returns the length of the string in bytes. -
Precision can be set to
0for whole-number output, or higher values for detailed rounding. -
Use triple braces (
{{{ }}}) when you need the numeric string unquoted, such as for logging or file size comparisons. -
bytes uses SI (base-1000) units (kB, MB, GB, TB), not binary (1024). E.g., 1024 will give output 1.02 kB; 1048576 will give output 1.05 MB.