Steps per Epoch Calculator
Calculate the number of training steps in one epoch from dataset and batch size.
About Steps per Epoch Calculator
The number of optimizer steps in one epoch is the dataset size divided by the batch size, rounded up (ceil) if the final partial batch is still processed, or rounded down (floor) if it's dropped. Most training loops default to processing the final partial batch (steps = ceil(dataset_size / batch_size)), which is why the last batch of an epoch is often smaller than the configured batch size unless the dataset size divides evenly.
Formula
steps_per_epoch = ceil(dataset_size / batch_size) [or floor if drop_last=True]
- dataset_size
- Total number of samples in the dataset
- batch_size
- Samples per training step
Worked example
With the default values below, Steps per Epoch Calculator returns Steps per Epoch of 3,125. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Dataset Sizeaccepts 1–1,000,000,000 samples
- 100,000 samples
- Batch Sizeaccepts 1–1,000,000 samples
- 32 samples
- Drop Incomplete Final Batch
- No
- Total Epochs (optional)accepts 0–1,000,000
- 10
Results
- Steps per Epoch
- 3,125
- Final Batch Size
- 32
- Total Training Steps
- 31,250
Step by step
- 1Steps per epoch: ceil(dataset_size ÷ batch_size)= 3,125
- 2Drop last disabled: ceil is used= 3,125
- 3Total steps: steps_per_epoch × total_epochs= 31,250
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
When should I enable 'Drop Incomplete Final Batch'?
Enable it when your training code uses drop_last=True (common in PyTorch DataLoader) to keep every batch the exact same size — useful for batch-norm statistics or fixed-shape hardware kernels — at the cost of not seeing a small fraction of the data each epoch.
Why does the final batch size differ from my configured batch size?
Unless dataset_size is an exact multiple of batch_size, the last batch in an epoch contains the remainder, e.g. 100 samples with batch size 32 gives three full batches of 32 plus one final batch of 4.
How does this relate to the Epoch Calculator?
This calculator solves for steps per epoch directly from dataset and batch size; the Epoch Calculator uses that relationship in reverse to convert between a total step budget and an equivalent number of epochs.
Does gradient accumulation change steps per epoch?
It changes how many optimizer updates occur, but not how many micro-batches are read — if you want optimizer steps per epoch under accumulation, divide this result by your accumulation step count.
