What are the difference between M and Mi in Kubernetes resources documentation?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
In Kubernetes resource specifications, M and Mi are different memory units that represent different byte counts. M (megabyte) is a decimal unit equal to 1,000,000 bytes, while Mi (mebibyte) is a binary unit equal to 1,048,576 bytes. They are not interchangeable: Mi is roughly 4.86% larger than M for the same numeric value. On top of that, lowercase m in CPU specifications means "millicpu" (thousandths of a CPU core), which is a completely different concept. Getting any of these mixed up leads to misconfigured resource requests and limits.
Decimal vs. Binary Units
Kubernetes follows the standard quantity notation that distinguishes between powers of 10 (SI/decimal) and powers of 2 (IEC/binary):
| Suffix | Name | Base | Bytes |
K | Kilobyte | 10^3 | 1,000 |
Ki | Kibibyte | 2^10 | 1,024 |
M | Megabyte | 10^6 | 1,000,000 |
Mi | Mebibyte | 2^20 | 1,048,576 |
G | Gigabyte | 10^9 | 1,000,000,000 |
Gi | Gibibyte | 2^30 | 1,073,741,824 |
T | Terabyte | 10^12 | 1,000,000,000,000 |
Ti | Tebibyte | 2^40 | 1,099,511,627,776 |
The "i" stands for "binary" (from the IEC standard naming). The difference grows with scale:
At the gigabyte level, the gap is over 73 MB. For a cluster running hundreds of pods, this discrepancy adds up.
CPU Units: The Lowercase m Trap
The most common confusion comes from lowercase m in CPU specifications. In the CPU context, m stands for "millicpu" (one-thousandth of a CPU core), not "mega" or "megabyte":
Quick reference:
| Notation | Resource | Meaning |
500m | CPU | Half a CPU core (500 millicpu) |
500M | Memory | 500,000,000 bytes (500 megabytes) |
500Mi | Memory | 524,288,000 bytes (500 mebibytes) |
These three look similar but represent entirely different quantities. Accidentally writing memory: "500m" would request 0.5 bytes of memory, which is nonsensical but syntactically valid in Kubernetes.
Real-World Manifest Examples
Standard Web Application
Memory-Intensive Data Processing
Sidecar Container
Why the Difference Matters Operationally
Scheduling and Bin Packing
The Kubernetes scheduler uses resource requests to decide which node can fit a pod. If you accidentally use M when you meant Mi (or vice versa), each pod requests a slightly different amount than intended. Across a fleet:
That 2.4 GB gap can mean the difference between fitting one more pod on a node or triggering a scale-up event.
OOM Kill Behavior
Memory limits are enforced by the Linux kernel via cgroups. If you set a limit of 1G (1,000,000,000 bytes) but your application expects 1Gi (1,073,741,824 bytes) of headroom, the process may get OOM-killed when it uses more than 1 GB but less than 1 GiB.
Monitoring Confusion
Most monitoring tools (Prometheus, Grafana, kubectl top) report memory in binary units. If your manifests use decimal units but your dashboards show binary values, the numbers will not match, creating confusion during incident response.
Inspecting Current Resource Usage
You can check what your pods actually use vs. what they request:
Validating Unit Consistency with OPA or Kyverno
For teams managing many manifests, policy engines can enforce consistent unit usage:
Recommended Team Conventions
A simple convention that eliminates confusion:
- Always use binary units for memory:
Mi,Gi. - Always use
m(millicpu) for fractional CPU:250m,500m,1000m. - Use whole numbers for full cores:
1,2,4. - Document the convention in a shared Helm values template or a policy as code rule.
This matches how operating systems report memory (in binary) and avoids any mismatch between what you specify and what monitoring tools report.
Common Pitfalls
- Treating
MandMias interchangeable. They differ by nearly 5% at the megabyte level and over 7% at the gigabyte level. This affects scheduling, OOM thresholds, and cost. - Confusing uppercase
M(memory megabytes) with lowercasem(CPU millicores).500Mof memory and500mof CPU are completely different things. - Mixing decimal and binary units across manifests within the same project. Inconsistency makes code reviews error-prone and monitoring confusing.
- Assuming Kubernetes normalizes units to match your intent. Kubernetes stores and enforces exactly what you write.
512Mand512Miresult in different cgroup limits. - Forgetting that
enotation is also valid.128974848(plain bytes) and129e6are valid memory values, but they make manifests harder to read and review.
Summary
Mis decimal megabytes (1,000,000 bytes) andMiis binary mebibytes (1,048,576 bytes). They are not interchangeable.- Lowercase
mis a CPU unit meaning millicpu (1/1000 of a core), completely unrelated to memory. - The percentage gap between decimal and binary grows with scale and affects scheduling, OOM behavior, and monitoring.
- Standardize on binary units (
Mi,Gi) for memory to match OS-level reporting. - Use policy engines like Kyverno or OPA to enforce unit conventions across your cluster.

