JSONL Shuffle
Shuffle a dataset into random order — reproducibly. The same seed always produces the same order, so a training run can be repeated exactly. Optionally shuffle whole groups so records belonging to one conversation or user stay together.
Shuffle
Why shuffle at all
Datasets arrive sorted far more often than people notice — by import date, by source file, by label. That ordering leaks into training:
- Sorted labels mean a batch can be entirely one class, which makes the gradient wildly unrepresentative.
- Sorted by source means the model sees one style at a time and the loss curve develops steps that look like bugs.
- Splitting a sorted file without shuffling gives you a validation set drawn entirely from the newest data — a distribution shift you then mistake for overfitting.
Shuffle before splitting. Train / val / test split and K-fold split both shuffle internally, so this page is for when you want the shuffled file itself.
Sampling with Take first N
Shuffle then truncate is the correct way to take a uniform random sample — every record has an equal chance of being included, which is not true of taking the first N lines of a file that arrived in some order. Because the shuffle is seeded, the sample is also reproducible, so "the 1,000-record sample" means the same thing to everyone using the same seed.
For proportional sampling that preserves a class balance, use Sampler instead.
Privacy
Nothing is uploaded. The whole thing runs in this tab, in your own browser. That matters here more than on most tool sites — training data is usually the most sensitive file a team owns.
Frequently asked questions
Is the shuffle uniform?
Yes — a Fisher–Yates shuffle driven by a seeded PRNG, so every permutation is equally likely for a given seed. The PRNG is not cryptographically secure, which does not matter for dataset ordering.
Same seed, different order. Why?
The input changed, or the group field or Take N changed. All of them feed the result. The seed alone fixes the random stream, not the data it is applied to.
Does grouping shuffle within a group?
No, deliberately. Records inside a group keep their original order, which matters when the group is a conversation whose turns are sequential.
Can it shuffle a file too big for memory?
Not here — a true shuffle needs the whole file. For very large files, shuffle by lines in a shell (shuf) or shuffle shard files and concatenate.