Skip to main content

Train/Validation/Test Split Calculator

Turns a row count and split percentages into whole-number train, validation and test sizes, with optional per-class stratified counts and k-fold sizes.

For planning a dataset split before you write any code.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

How the sizes are worked out

  • Split sizes: total rows × percentage, floored, then leftover rows to the largest fractional remainders.
  • Class totals: your class counts, scaled to the total number of rows with the same rounding rule.
  • Stratified rows: train rows are spread across classes by class size; validation is spread across what remains; each class's remainder is its test count.
  • K-fold: first N mod k folds get one extra validation row.

Because every step uses the same rounding rule, the rows in each split and the rows in each class both add up exactly.

Worked examples

  • Defaults: 10,000 rows, 80/10/10 gives 8,000, 1,000 and 1,000 rows. With classes 900 and 100, the class totals are 9,000 and 1,000. The majority class gets 7,200 train, 900 validation and 900 test; the minority class gets 800, 100 and 100. Both keep the 90/10 class ratio in every split.
  • 5-fold: each fold holds out 2,000 rows and trains on 8,000.
  • Uneven: 1,003 rows, 70/15/15, 4 folds. Splits are 702, 151 and 150. Fold validation sizes are 251, 251, 251 and 250, with training sizes 752, 752, 752 and 753.

A tiny minority class can round to very few rows per split. With 20 positives at a 10% test share you get 2 test positives, which is a very noisy estimate.

Limits and sources

  • Counts, not a splitter: no randomness or row selection is involved.
  • Grouped data: if rows share a user, patient or document, sizes alone do not prevent leakage across splits; split by group.
  • Time series: random-style splits are inappropriate when order matters.

Sources: largest remainder (Hare quota) apportionment, as described in UN Electoral System Design and Reform; scikit-learn documentation for KFold and StratifiedShuffleSplit.

Frequently Asked Questions

Common questions about the Train/Validation/Test Split Calculator

Each split gets the whole-number part of its share, then the leftover rows go to the splits with the largest fractional remainders (the largest remainder method), with ties going in the order train, validation, test. This guarantees the three counts add up to your total. For 1,003 rows at 70/15/15 you get 702, 151 and 150, rather than rounding each independently.

From the same team

Stop paying per token — route AI requests to your own GPU

Wide Area AI is a local-first AI gateway: repeated requests hit an edge cache, the rest run free on your own hardware, and the cloud is only a failover. OpenAI-compatible endpoint, free tier.

Start routing — free

Explore More Tools

Explore these related tools for your next step.

ai
ai
ai
ai
ai
ai