OpsPane

Convert Kubernetes CPU and memory quantities: millicores, Mi vs M, the form kubectl shows, and the mistakes that break a limit.

Resource

Stored and shown by kubectl as

1536Mi

1,610,612,736 bytes.

Exact

bytes
1,610,612,736

Binary (×1024)

Ki
1,572,864
Mi
1,536
Gi
1.5

Decimal (×1000)

k
1,610,612.736
M
1,610.613
G
1.611
    Updated Runs locally in your browser

    Quick answer

    • CPU: m is milli, so 500m is half a core; one core is 1 or 1000m.
    • Memory: Mi is a power of 1024 (1024² bytes) and M a power of 1000 (1000² bytes): 512Mi is 536,870,912 bytes, 512M is 512,000,000 bytes.
    • Lowercase m on memory is milli too: 128m is 0.128 bytes, rounded up to 1 byte. Write 128Mi.
    • The API server stores a canonical spelling of the same amount: 1.5Gi becomes 1536Mi and 0.5 becomes 500m.

    How to convert Kubernetes CPU and memory units

    1. Type a quantity exactly as it appears in your manifest: 500m, 0.25, 1.5Gi, 512M.
    2. Pick what it is for — CPU, memory or storage. The same text means very different things: 128m is a fair CPU request and an impossible memory limit.
    3. Read the form the API server stores, the exact bytes or millicores, and the conversions. When a note offers a fix, its button puts the corrected value in.

    Kubernetes quantity suffixes

    A quantity is a number followed by an optional suffix, with no space. Decimal suffixes are powers of 1000, binary ones powers of 1024, and they are case-sensitive.

    SuffixMultiplies byExample
    mmilli, 10⁻³500m
    (none)12
    k10³100k
    M10⁶512M
    G10⁹1G
    T10¹²1T
    Ki2¹⁰ = 1,02464Ki
    Mi2²⁰ = 1,048,576256Mi
    Gi2³⁰ = 1,073,741,8242Gi
    Ti2⁴⁰1Ti
    e10ⁿ, as an exponent1e3

    The parser also accepts n (nano) and u (micro), and P, E, Pi, Ei at the large end.

    What you write and what kubectl shows

    The API server rewrites each quantity into a canonical spelling of the same amount. Every row below is computed with the same rules this tool uses:

    You writeStored asKubernetes uses
    0.5500m500m
    1000m11,000m
    1.51500m1,500m
    1.5Gi1536Mi1,610,612,736 bytes
    2048Ki2Mi2,097,152 bytes
    0.5Ki512512 bytes
    1000k1M1,000,000 bytes
    1e31e31,000,000m

    Gotchas this tool checks for

    Lowercase m on memory is milli, not mega

    128m of memory is 0.128 bytes, rounded up to 1 byte. It passes validation, so the mistake only shows when the container cannot start or is killed at once. The tool flags it and offers 128Mi.

    M and Mi are not the same amount

    512M is 512,000,000 bytes; 512Mi is 536,870,912 bytes. Mixing them between a request and a limit, or between Kubernetes and a JVM or Node.js heap flag, leaves you a few percent short — more as the units grow.

    M ≠ Mi1 of each decimal unit against its binary twin
    Each full track is the binary unit; the lime bar is the decimal one. The gap grows with every step: 1G is 6.9% smaller than 1Gi, 1T 9.1% smaller than 1Ti.

    CPU in byte units, and CPU below a millicore

    2Gi of CPU is two billion cores — a copy-paste from the memory line. And CPU is counted in whole millicores, so 0.5m becomes 1m. Both get a warning.

    Capital K, B and spaces

    1K, 512MB, 1GiB and 512 Mi are rejected by the API server. The tool says why and suggests the spelling Kubernetes accepts.

    From one value to a whole Pod

    A quantity is only half of the story: whether a container gets a request equal to its limit decides the Pod's QoS class, init and sidecar containers change what the scheduler reserves, and the HorizontalPodAutoscaler measures utilization against the request.

    Verification

    FAQ

    What does 500m mean for CPU in Kubernetes?

    500m is 500 millicores: half of one CPU core (one vCPU on a cloud node). 0.5 and 500m are the same request; the API server stores both as 500m. One core is 1 or 1000m.

    What is the difference between Mi and M in Kubernetes?

    Mi is a power of 1024 (mebibytes) and M a power of 1000 (megabytes): 512Mi is 536,870,912 bytes, 512M is 512,000,000 bytes. 512M is 4.6% less memory than 512Mi, and the gap grows to 6.9% for G against Gi and 9.1% for T against Ti. Most memory limits are written in Mi and Gi.

    Why does my memory request of 128m not work?

    Lowercase m means milli, so 128m is 0.128 bytes — Kubernetes rounds it up to 1 byte. It is a valid quantity, so nothing rejects it, but as a limit no container can run in it. Write 128Mi (or 128M).

    Why does kubectl show a different value from what I wrote?

    The API server stores every quantity in a canonical form: decimal values use the largest suffix that keeps a whole number (0.5 → 500m, 1000m → 1) and binary values a whole number of the largest power of 1024 (1.5Gi → 1536Mi). The amount is identical; only the spelling changes.

    Can CPU be smaller than 1m?

    A value such as 0.5m is accepted, but CPU is read in whole millicores and rounded up, so it becomes 1m. Kubernetes keeps quantities to nanounits at most; anything finer is rounded up as well.

    Is 1K a valid Kubernetes quantity?

    No. The decimal kilo suffix is lowercase k (1k = 1000) and the binary one is Ki (1Ki = 1024). Suffixes are case-sensitive, and there is no B: write 512Mi, not 512MiB or 512MB.

    Private by design

    Your input is processed in this browser tab and never sent to our servers. Privacy policy