staticdata.dev
Menu
Datasets About Contact

Data Storage Units

18 data storage units covering both the decimal (SI) and binary (IEC 80000-13) systems: the universal bit and byte, decimal prefixed units (KB, MB, GB, TB, PB, EB, ZB, YB) where each step is a power of 1000, and their binary counterparts (KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB) where each step is a power of 1024. Byte counts are stored as strings to preserve precision for large values beyond JavaScript's safe integer range.

Quick fetch

Stable URL. CORS-enabled. No auth.

bash
curl https://staticdata.dev/v1/data-units.json

Or use as a typed import: import { dataUnits } from "https://staticdata.dev/v1/data-units.ts"

Formats

  • JSON 1.9 KB

    /v1/data-units.json

    Open

    min: 1.3 KB · /v1/data-units.min.json

  • CSV 644 B

    /v1/data-units.csv

    Open
  • TypeScript 2.1 KB

    /v1/data-units.ts

    export const dataUnits

    type DataUnit = (typeof dataUnits)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
Field Type Description Example
name string Full name of the unit (e.g. Kilobyte, Kibibyte) Kilobyte
symbol string Standard symbol/abbreviation (e.g. KB, KiB) KB
bytes string Exact number of bytes as a string to preserve precision for large values 1000
system string Prefix system: decimal (powers of 1000), binary (powers of 1024), or both (bit and byte) decimal

Preview

First 10 records.

Data preview
namesymbolbytessystem
Bitb0.125both
ByteB1both
KilobyteKB1000decimal
KibibyteKiB1024binary
MegabyteMB1000000decimal
MebibyteMiB1048576binary
GigabyteGB1000000000decimal
GibibyteGiB1073741824binary
TerabyteTB1000000000000decimal
TebibyteTiB1099511627776binary

Showing 10 of 18. View full data:  JSON · CSV

Fetch examples

Drop-in snippets in five languages.

curl
curl -sSL https://staticdata.dev/v1/data-units.json | jq '.[0]'
JavaScript
import type { DataUnit } from "https://staticdata.dev/v1/data-units.ts";

const res = await fetch("https://staticdata.dev/v1/data-units.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const dataUnits: DataUnit[] = await res.json();
console.log(dataUnits[0]);
Python
import urllib.request, json

with urllib.request.urlopen("https://staticdata.dev/v1/data-units.min.json") as r:
    dataUnits = json.load(r)

print(dataUnits[0])
Go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	resp, err := http.Get("https://staticdata.dev/v1/data-units.min.json")
	if err != nil { panic(err) }
	defer resp.Body.Close()

	var data []map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
		panic(err)
	}
	fmt.Println(data[0])
}
Rust
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let body = ureq::get("https://staticdata.dev/v1/data-units.min.json").call()?.into_string()?;
    let data: Vec<Value> = serde_json::from_str(&body)?;
    println!("{:?}", data.first());
    Ok(())
}

Sources and methodology

This dataset was curated from the IEC 80000-13:2008 international standard, which incorporates the binary prefixes (kibi-, mebi-, gibi-, etc.) that the IEC first introduced in 1998 to eliminate ambiguity between decimal and binary interpretations of units like “kilobyte”. The decimal SI prefixes follow the International System of Units where each step multiplies by exactly 1000.

The bytes field is stored as a string rather than a number because values at the zettabyte and yottabyte scale exceed JavaScript’s Number.MAX_SAFE_INTEGER (2^53 - 1). For example, 1 YiB = 1,208,925,819,614,629,174,706,176 bytes, which cannot be represented exactly as a 64-bit float. Callers that need arithmetic on these values should use BigInt in JavaScript or an arbitrary-precision library. The bit (b) and byte (B) entries use system: "both" since they are foundational units shared by both systems.

A common source of confusion is that operating systems historically reported file sizes using binary units but labelled them with decimal symbols (e.g., Windows reports 1 GiB as “1 GB”). Some systems (macOS, many Linux tools, drive manufacturers) now use decimal units, while others still label binary multiples with decimal symbols, so the ambiguity persists. In this dataset KB/MB/GB etc. always mean 10^3/10^6/10^9 bytes, and KiB/MiB/GiB etc. always mean 2^10/2^20/2^30 bytes. Note that the SI symbol for the kilo prefix is lowercase (kB); the uppercase KB used here is the common industry spelling. The 2022 SI prefixes ronna (10^27) and quetta (10^30) are not included, since no corresponding binary prefixes have been standardised.

Versioning

URLs under /v1/ are stable: field names and types will not change in a way that breaks consumers. Values can be corrected or records added when the upstream source changes; schema-incompatible updates ship under a new version path. See the data-units changelog for this dataset's history.

More Code datasets