Works on this device
Kubernetes Quantity Converter
Read a quantity from a Kubernetes manifest, such as 1.5Gi, 128Mi, 500m or 1e3. See how Kubernetes writes it back, its exact value in bytes or cores, and the same amount in other units. You can also turn an amount such as 1.5 GiB or 250 millicores into a quantity.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use this converter
- Choose Read a quantity, Write an amount as a quantity, or Compare or add two quantities.
- Type the quantity as it stands in the manifest, with no space before the suffix:
512Mi, not512 Mi. - Choose what it measures: memory or storage (bytes), CPU (cores), or a plain number.
- Choose Convert. Copy the canonical form, or download the result as a CSV file.
The suffixes
| Suffix | Means | Example |
|---|---|---|
| Ki, Mi, Gi, Ti, Pi, Ei | 1024, 1024², 1024³, 1024⁴, 1024⁵, 1024⁶ | 1Mi = 1,048,576 |
| k, M, G, T, P, E | 1000, 1000², 1000³, 1000⁴, 1000⁵, 1000⁶ | 1M = 1,000,000 |
| m, u, n | a thousandth, a millionth, a thousand-millionth | 500m = 0.5 |
| e3, E-3 | times 10 to that power | 1e3 = 1000, 1E-3 = 0.001 |
| (none) | the number itself | 2 = 2 |
Upper and lower case matter. M is a million but m is a thousandth: 400m of memory is 0.4 bytes, which the Kubernetes documentation gives as a common mistake. Kilo is a small k; there is no K and no B.
The canonical form
- Kubernetes keeps the kind of suffix you used: binary (Ki, Mi ...), decimal (k, M, m ...) or exponent (e).
- It writes the number as a whole number with the largest suffix that keeps it whole. So
1.5Gibecomes1536Mi,1.5becomes1500m, and2000becomes2k. - A binary value below 1024, or one that is not a whole number, is written with a decimal suffix:
0.5Kibecomes512. - A value with a part smaller than a thousand-millionth (10^-9) is rounded up, away from zero:
3.001nbecomes4n. - This page does the arithmetic with exact fractions, so no digit is lost.
Worked examples
1.5Giis 1.5 × 1,073,741,824 = 1,610,612,736 bytes, which is 1,536 MiB or about 1,610.61 MB. Kubernetes writes it as1536Mi.123Miis 123 × 1,048,576 = 128,974,848 bytes. The Kubernetes documentation lists128974848,129e6,129M,128974848000mand123Mias about the same amount.250mof CPU is 0.25 of a core. 1.5 cores is1500m.1Giis larger than1Gby 73,741,824 bytes; the first is 1.073741824 times the second.
Limits you should know
- Values above 9,223,372,036,854,775,807 (2^63 − 1) are refused. Kubernetes keeps no larger quantity.
- A CPU amount finer than 1m (0.001 of a core) is not allowed by Kubernetes; the page warns about it.
- The page reads quantities only. To work out the requests and limits of a whole pod, use the Container Resource Calculator.