> Markdown version of https://opspane.dev/kubernetes/resource-units/ for AI agents and readers: the same text, without navigation or the interactive tool.
>
> The tool computes its result with JavaScript in the browser, so this file holds the reference text, worked examples and FAQ. Open the page to run it on your own input.
>
> Link the Kubernetes resource units converter with a quantity: `q` and `r` (cpu, memory or storage), e.g. https://opspane.dev/kubernetes/resource-units/?q=512M&r=memory
>
> Answer endpoint for agents: the same URL parameters on https://opspane.dev/kubernetes/resource-units/answer.md return the computed result as Markdown, without JavaScript, e.g. https://opspane.dev/kubernetes/resource-units/answer.md?q=512M&r=memory

# Kubernetes Resource Units Converter

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

## 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.

| Suffix | Multiplies by | Example |
| --- | --- | --- |
| `m` | milli, 10⁻³ | `500m` |
| `(none)` | 1 | `2` |
| `k` | 10³ | `100k` |
| `M` | 10⁶ | `512M` |
| `G` | 10⁹ | `1G` |
| `T` | 10¹² | `1T` |
| `Ki` | 2¹⁰ = 1,024 | `64Ki` |
| `Mi` | 2²⁰ = 1,048,576 | `256Mi` |
| `Gi` | 2³⁰ = 1,073,741,824 | `2Gi` |
| `Ti` | 2⁴⁰ | `1Ti` |
| `e` | 10ⁿ, as an exponent | `1e3` |

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 write | Stored as | Kubernetes uses |
| --- | --- | --- |
| `0.5` | `500m` | 500m |
| `1000m` | `1` | 1,000m |
| `1.5` | `1500m` | 1,500m |
| `1.5Gi` | `1536Mi` | 1,610,612,736 bytes |
| `2048Ki` | `2Mi` | 2,097,152 bytes |
| `0.5Ki` | `512` | 512 bytes |
| `1000k` | `1M` | 1,000,000 bytes |
| `1e3` | `1e3` | 1,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 ≠ Mi` 1 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.

[Check a Pod's QoS class and requests](https://opspane.dev/kubernetes/requests-limits/) [Kubernetes HPA calculator](https://opspane.dev/kubernetes/hpa-calculator/)

## Verification

- Parsing, rounding and the canonical form follow `resource.Quantity` in `k8s.io/apimachinery`: the same grammar, the round-up to 1n, the int64 cap on binary values and the String() rules. The unit tests use vectors from its `quantity_test.go` (0.1 → 100m, 1.5Gi → 1536Mi, 0.5Ki → 512, 1.1e3 → 1100).
- Arithmetic is exact: values are held as whole nanounits in BigInt, so no floating-point rounding reaches a result.
- Bytes and millicores round up the way `Value()` and `MilliValue()` do.
- The engine runs in this tab; nothing you type is sent anywhere.

## 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.

## Related tools

- [Kubernetes QoS Class & Requests Checker](https://opspane.dev/kubernetes/requests-limits/): Paste a Pod or Deployment: get its QoS class and why, the Pod request with init and sidecar containers, oom_score_adj and how many Pods fit a node.
- [EKS Max Pods Calculator](https://opspane.dev/kubernetes/eks-max-pods/): Calculate max pods per node for every EC2 instance type, with prefix delegation and the IP addresses your pod CIDR must hold.
- [Kubernetes Secret Decoder](https://opspane.dev/kubernetes/secret-decoder/): Decode every value in a Kubernetes Secret from pasted YAML and encode data back into a manifest. Nothing leaves your browser.
- [Kubernetes CronJob Generator](https://opspane.dev/cron/kubernetes/): Generate a complete CronJob manifest with schedule, timeZone, concurrencyPolicy and history limits, explained field by field.
- [Kubernetes HPA Calculator](https://opspane.dev/kubernetes/hpa-calculator/): How many replicas will the HPA ask for, and why? The controller's exact math: tolerance, missing and unready pods, several metrics and behavior.
