FLOPs Calculator
Calculate FLOPs for AI model training and inference.
Compute Parameters
Formula: 2 x Parameters x Tokens
Total FLOPs
14.00 PFLOPs
1.40e+16 operations
Estimated Time by GPU
What the FLOPs Calculator Does
The FLOPs calculator estimates the number of floating point operations required to run a large language model, either for inference (a forward pass) or for training (forward pass plus backward pass and optimizer update). FLOPs, short for floating point operations, are the fundamental currency of deep learning compute. Whether you are budgeting GPU hours, comparing hardware, or sizing a cloud bill, knowing the raw operation count is the first step. This calculator takes four numbers you already know about your workload — model size in billions of parameters, sequence length, batch size, and the total number of tokens to process — and converts them into total FLOPs, FLOPs per token, FLOPs per batch, and an estimated wall-clock time on five popular NVIDIA GPUs.
The headline output is total FLOPs, shown in teraflops (TFLOPs), petaflops (PFLOPs), or exaflops (EFLOPs) depending on scale. One petaflop is 1015 operations and one exaflop is 1018 operations, so even a modest inference job over a million tokens lands in the petaflop range. The calculator also reports FLOPs per token — the per-token cost that scales linearly with model size — and FLOPs per batch, which folds in your sequence length and batch size. Because the underlying relationship is linear in parameters and in tokens, the calculator is fast, transparent, and easy to sanity-check by hand.
Why does this matter? Compute is the single largest driver of cost in modern AI. A 7-billion-parameter model that costs a few cents to query becomes a multi-thousand-dollar bill when run across an entire corpus. Training is roughly three times more expensive per token than inference because it adds the backward pass and gradient computation. By separating the two operation modes, the FLOPs calculator lets you reason about both serving costs and training budgets with the same simple mental model. Use it to compare a 7B model against a 70B model, to decide whether an RTX 4090 is enough or whether you need an H100, or to estimate how long a fine-tuning run will take before you ever spin up a cluster.
The FLOPs Formula
The calculator uses the widely cited approximation popularized by OpenAI's scaling-laws and Kaplan et al. work: a single forward pass through a transformer costs about two FLOPs per parameter per token, because each weight participates in one multiply and one add (a multiply-accumulate). Training adds a backward pass that is roughly twice the cost of the forward pass, giving the familiar six FLOPs per parameter per token rule of thumb for a full training step.
The per-token cost is multiplied by the total number of tokens to get total FLOPs. Separately, the per-batch figure multiplies the per-token cost by the sequence length and the batch size, showing the operations contained in one batch of the chosen context length.
Total FLOPs for Inference and Training
Where:
- operation= Mode: 'inference' uses a factor of 2, 'training' uses a factor of 6
- params= Model size in billions of parameters (multiplied by 1e9 to get raw parameter count)
- tokens= Total number of tokens to process
- flopsPerToken= Per-token cost = factor x (params x 1e9)
- flopsPerBatch= flopsPerToken x sequenceLength x batchSize
How GPU Time Is Estimated
Raw FLOPs only become useful when you divide them by a GPU's throughput. The calculator estimates wall-clock time by dividing total FLOPs by the effective throughput of each GPU, where effective throughput is the peak rate multiplied by 50%. The 50% factor (Model FLOPs Utilization, or MFU) is a realistic assumption: real workloads rarely hit advertised peak numbers because of memory bandwidth limits, kernel launch overhead, and pipeline bubbles. Well-optimized training runs on large clusters often land between 40% and 55% MFU, so 50% is a sensible default for a planning tool.
The peak throughput figures used for each GPU are listed below. These are dense, lower-precision tensor-core rates typical of mixed-precision LLM workloads.
| GPU | Peak Throughput | Effective (50%) |
|---|---|---|
| NVIDIA H100 | 989 TFLOPS | 494.5 TFLOPS |
| NVIDIA A100 80GB | 312 TFLOPS | 156 TFLOPS |
| NVIDIA V100 | 125 TFLOPS | 62.5 TFLOPS |
| RTX 4090 | 82.6 TFLOPS | 41.3 TFLOPS |
| RTX 3090 | 35.6 TFLOPS | 17.8 TFLOPS |
To read the result, take total FLOPs and divide by the effective TFLOPS expressed in raw operations per second. For example, an H100 at 50% delivers 4.945 x 1014 operations per second, so a 1.4 x 1016 FLOP job finishes in about 28 seconds. The calculator automatically formats the answer in seconds, minutes, hours, or days so you can quickly see whether a workload is a coffee break or a multi-day commitment.
Understanding the Inputs
Each input maps directly to a term in the formula, so it helps to know what each one controls. Operation Type switches the leading multiplier between 2 (inference) and 6 (training). If you are only serving a model, choose inference; if you are fine-tuning or pretraining, choose training, which triples the per-token cost.
- Model Parameters (Billions): the size of the network. A value of 7 means a 7B model; the calculator multiplies by 109 internally. Larger models cost proportionally more per token.
- Sequence Length: the context length of a single example, such as 2048 or 8192 tokens. This only affects the FLOPs-per-batch figure in this tool, not the total, which is driven by the token count.
- Batch Size: the number of sequences processed together. Together with sequence length it determines the operations contained in one batch.
- Total Tokens to Process: the size of your full job — the number of tokens you will generate at inference time or train over during a run. This is the main lever for total FLOPs.
Note that this approximation treats the dominant cost as the matrix multiplications in the dense and attention projection layers, which scale with parameter count. It deliberately omits second-order attention terms that grow quadratically with sequence length; for the long-context regime those terms can matter, but for most practical model and context sizes the parameter-driven term dominates, keeping the estimate simple and accurate to within a small factor.
Why FLOPs Matter for Cost and Hardware
FLOPs are the bridge between an abstract model and a concrete dollar figure. Cloud providers price GPU instances by the hour, and the number of hours you need is total FLOPs divided by effective throughput. Once you know the hours, you multiply by the hourly rate to estimate spend. This is why the FLOPs calculator is a planning tool as much as a math tool: it turns a model spec into a schedule and a budget.
The 6x versus 2x distinction is one of the most useful facts in applied deep learning. Because training is three times more expensive per token than inference, organizations that fine-tune frequently can spend far more on training than on serving, even when serving volume is high. Conversely, a model served at massive scale — billions of inference tokens per day — can quietly accumulate enormous compute costs even though each individual query is cheap. Running both scenarios through the calculator side by side makes the trade-off obvious.
Hardware selection also follows directly from FLOPs. An H100 is roughly 3x faster than an A100 and about 12x faster than an RTX 4090 on these tensor-core rates, so a job that takes a day on a consumer card may finish in a couple of hours on a data-center accelerator. The calculator lets you weigh raw speed against availability and price: sometimes a slower, cheaper GPU is the economical choice for a non-urgent batch job, while an H100 is worth the premium for latency-sensitive serving. By making total FLOPs, per-token cost, and per-GPU time visible at a glance, this tool helps you choose the right accelerator before committing real money.
Worked Examples
7B Model Inference Over 1 Million Tokens
Problem:
You want to run inference with a 7B-parameter model over 1,000,000 tokens. How many FLOPs is that, and how long on an H100?
Solution Steps:
- 1Per-token cost (inference): 2 x (7 x 1e9) = 1.4 x 10^10 FLOPs per token.
- 2Total FLOPs: 1.4 x 10^10 x 1,000,000 = 1.4 x 10^16 FLOPs, which is 14 petaflops.
- 3H100 effective throughput: 989e12 x 0.5 = 4.945 x 10^14 ops/sec.
- 4Time: 1.4 x 10^16 / 4.945 x 10^14 = 28.3 seconds.
Result:
14 PFLOPs total, finishing in about 28 seconds on an H100 at 50% utilization.
Training a 13B Model Step
Problem:
Estimate the FLOPs to train a 13B model over 500,000 tokens, and the time on an A100 80GB.
Solution Steps:
- 1Per-token cost (training): 6 x (13 x 1e9) = 7.8 x 10^10 FLOPs per token.
- 2Total FLOPs: 7.8 x 10^10 x 500,000 = 3.9 x 10^16 FLOPs, which is 39 petaflops.
- 3A100 effective throughput: 312e12 x 0.5 = 1.56 x 10^14 ops/sec.
- 4Time: 3.9 x 10^16 / 1.56 x 10^14 = 250 seconds, about 4.2 minutes.
Result:
39 PFLOPs total, roughly 4.2 minutes on an A100 80GB at 50% utilization.
FLOPs per Batch for a 70B Model
Problem:
A 70B model runs inference with a sequence length of 2048 and a batch size of 4. What is the FLOPs-per-batch figure?
Solution Steps:
- 1Per-token cost (inference): 2 x (70 x 1e9) = 1.4 x 10^11 FLOPs per token.
- 2Multiply by sequence length: 1.4 x 10^11 x 2048 = 2.867 x 10^14.
- 3Multiply by batch size: 2.867 x 10^14 x 4 = 1.147 x 10^15 FLOPs.
- 4Convert to TFLOPs for the on-screen display: 1.147 x 10^15 / 1e12 = 1146.88 TFLOPs.
Result:
About 1.15 PFLOPs (1146.88 TFLOPs) of compute per batch.
Tips & Best Practices
- ✓Use the inference mode (2x) for serving estimates and training mode (6x) for fine-tuning or pretraining budgets.
- ✓Multiply the H100 hours from the calculator by your provider's hourly rate to get a fast cost estimate.
- ✓Remember the 50% utilization assumption is optimistic for small models and consumer GPUs; halve your expectations there.
- ✓Total FLOPs scale linearly with parameters, so a 70B model costs exactly 10x a 7B model for the same tokens.
- ✓For long-context workloads above 32k tokens, add a margin because quadratic attention costs are not modeled here.
- ✓Compare two GPUs by running the same inputs and reading the time field; an H100 is about 3x faster than an A100.
- ✓Batch size and sequence length only affect the per-batch figure in this tool, not the total FLOPs.
- ✓Sanity-check any estimate by hand: per-token FLOPs equals the factor times parameter count.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-05
Help us improve!
How would you rate the FLOPs Calculator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various