Toolvito

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

Type a quantity from a manifest, such as 1.5Gi or 500m. You get the form Kubernetes writes back and the exact value in bytes or cores.

Your values

As in a Kubernetes manifest: 500m, 2, 1.5Gi, 128Mi or 1e3, with no space before the suffix.

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.

How to use this converter

  1. Choose Read a quantity, Write an amount as a quantity, or Compare or add two quantities.
  2. Type the quantity as it stands in the manifest, with no space before the suffix: 512Mi, not 512 Mi.
  3. Choose what it measures: memory or storage (bytes), CPU (cores), or a plain number.
  4. Choose Convert. Copy the canonical form, or download the result as a CSV file.

The suffixes

Suffixes of a Kubernetes quantity
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.5Gi becomes 1536Mi, 1.5 becomes 1500m, and 2000 becomes 2k.
  • A binary value below 1024, or one that is not a whole number, is written with a decimal suffix: 0.5Ki becomes 512.
  • A value with a part smaller than a thousand-millionth (10^-9) is rounded up, away from zero: 3.001n becomes 4n.
  • This page does the arithmetic with exact fractions, so no digit is lost.

Worked examples

  • 1.5Gi is 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 as 1536Mi.
  • 123Mi is 123 × 1,048,576 = 128,974,848 bytes. The Kubernetes documentation lists 128974848, 129e6, 129M, 128974848000m and 123Mi as about the same amount.
  • 250m of CPU is 0.25 of a core. 1.5 cores is 1500m.
  • 1Gi is larger than 1G by 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.

Related tools