GB vs GiB in Kubernetes, Docker and Cloud Configs: Avoid the 7% Gap

Learn how Kubernetes, Docker, JVM flags and cloud consoles use GB and GiB, convert between them, and avoid out-of-memory errors caused by mixed units.

Updated September 29, 2026 4 min read

Use the free GB to GiB ConverterConvert decimal gigabytes to binary gibibytes to explain missing space

You set a container's memory limit to "4G", the application inside it expects "4 GiB" of heap, and a few hours later the pod is killed for running out of memory. Or a capacity plan written in gigabytes does not match the instance sizes in a cloud console, which lists memory in gibibytes. The two units differ by about 7% at the gigabyte scale, which is easily enough to turn a comfortable margin into an outage.

This guide explains exactly how GB and GiB differ, how common configuration formats interpret suffixes, and how to convert and check your numbers before they reach production.

GB and GiB

  • 1 GB (gigabyte) = 10⁹ bytes = 1,000,000,000 bytes. Decimal, SI prefix.
  • 1 GiB (gibibyte) = 2³⁰ bytes = 1,073,741,824 bytes. Binary, IEC prefix.

So:

GiB = GB × 0.931323
GB  = GiB × 1.073742
GB GiB
0.5 0.466
1 0.931
2 1.863
4 3.725
8 7.451
16 14.901
32 29.802
64 59.605
128 119.209

And the other way: 4 GiB is 4.295 GB; 16 GiB is 17.180 GB; 64 GiB is 68.719 GB.

The gap grows with each prefix: about 2.4% for KiB vs KB, 4.9% for MiB vs MB, 7.4% for GiB vs GB. The fact that memory chips are built in powers of two is why binary units are so common in systems software. For a broader explanation, see is 1 GB 1,000 MB or 1,024 MB.

Converting with the tool

The GB to GiB Converter is handy when translating between a plan and a config:

  1. Open the converter. The left box is labelled Gigabytes (GB), the right box Gibibytes (GiB).
  2. Type the decimal figure, for example 16.
  3. Read the result: 16 GB = 14.90116119 GiB.
  4. To go from a binary figure to decimal, type into the GiB box. 4 GiB gives 4.294967296 GB.
  5. The list underneath shows the same amount in MB, MiB, bytes and more, so you can match any suffix a tool uses.
  6. Copy the result into your config review or ticket.

How common tools read memory suffixes

Always check the current documentation for the exact version you run, but these conventions are widely used:

Kubernetes

Kubernetes resource quantities support both families:

  • Decimal: k, M, G, T (powers of 1,000)
  • Binary: Ki, Mi, Gi, Ti (powers of 1,024)

So memory: 4G is 4,000,000,000 bytes and memory: 4Gi is 4,294,967,296 bytes, a difference of about 295 MB. A lowercase m means milli (one thousandth), not mega; a memory value like 512m is interpreted as a fraction of a byte, which is almost never intended. Use Mi or M.

Docker

Docker's memory flags accept suffixes such as b, k, m and g, which it treats as binary units. --memory 4g therefore means 4 GiB.

JVM heap flags

Java's -Xmx and -Xms flags accept k, m and g suffixes, which are also binary. -Xmx4g is 4 GiB of heap.

Cloud consoles

Many cloud providers list instance memory in GiB. A plan written in GB may appear to need a bigger instance than it does, or a smaller one, depending on which way the conversion was skipped.

A classic out-of-memory scenario

  1. A container limit is set to memory: 4G in Kubernetes: 4,000,000,000 bytes, which is 3.725 GiB.
  2. The JVM inside is started with -Xmx4g: 4 GiB of heap alone, 4,294,967,296 bytes.
  3. On top of the heap, the JVM needs memory for metaspace, thread stacks, code cache and native buffers.

The heap limit alone is already larger than the container limit. When the heap fills, the container exceeds its limit and is killed. Fixing the unit (4Gi) is not enough on its own; the container limit must also leave room for non-heap memory. Many teams size the heap as a fraction of the container limit for this reason.

Checking your numbers

  • Write units explicitly. In docs and tickets, always write GB or GiB, never just "G".
  • Pick one convention per system. For Kubernetes manifests, many teams standardise on Mi and Gi so the numbers match what the kernel and runtime report.
  • Convert to bytes when in doubt. Bytes are unambiguous. The tool's list of other units shows the exact byte count.
  • Review diffs for suffix changes. A change from Gi to G looks trivial in review, but changes the value by 7%.

Other ways to convert

  • Spreadsheet: =A2*1e9/2^30 for GiB from GB, =A2*2^30/1e9 for GB from GiB.
  • Command line: numfmt --to=iec 4000000000 prints a byte count in binary units on GNU systems, and --to=si prints decimal.
  • Mental estimate: GiB is about 7% less than GB. 32 GB is about 30 GiB.

For megabyte-sized values, such as container requests of a few hundred MiB, use MiB to MB. For drive capacities rather than memory, TB to GB and GB to MB cover the decimal side.

Frequently asked questions

What is the difference between GB and GiB?

A GB is 1,000,000,000 bytes and a GiB is 1,073,741,824 bytes. A GiB is about 7.4% larger.

Is 4Gi the same as 4G in Kubernetes?

No. 4Gi is 4,294,967,296 bytes; 4G is 4,000,000,000 bytes.

Does Docker use GB or GiB for memory limits?

Docker treats its k, m and g suffixes as binary units, so 4g means 4 GiB.

Why does my cloud instance show 16 GiB instead of 16 GB?

Many providers list memory in binary units. 16 GiB is about 17.18 GB.

What does 512m mean in Kubernetes memory?

A lowercase m means milli, so 512m is 0.512 bytes, which is almost certainly a mistake. Use 512Mi or 512M.

Try it now: GB to GiB Converter

Loading tool…