On-device AI — professional-grade, fully private.

Text Line Sorter Tool

Sort text lines A-Z, by length, number, column or word count

  • No upload — runs on your device
  • Ten sort criteria, both directions
  • Half a million lines without freezing

Drop a text file, or paste below

.txt .text .csv .tsv .md .markdown .log .list · up to 25 MB

Input text (one item per line)0 lines
Sorted text—
Sort settings
Presets
Sort by

A second criterion decides the order inside groups the first one leaves equal.

Matching
Lines
Input and output
Line endings

Turn off to sort only when you press the button.

How to sort a list of text lines

Four steps, and the result updates while you are still editing. Nothing is sent anywhere — the sorting happens on the device you are reading this on.

  1. 1

    Add your list

    Paste text with one item per line, or drop a .txt, .csv, .tsv, .md or .log file. Nothing is uploaded.

  2. 2

    Choose what to sort by

    Pick a criterion — A-Z, natural, numeric, length, word count, month, weekday, last word, reverse or shuffle — and set ascending or descending.

  3. 3

    Refine the match

    Optionally sort by a column, choose the language rules, remove duplicates, trim each line, or decide where blank lines go.

  4. 4

    Take the result

    The sorted list updates as you type. Copy it, download it as a text file, or feed it back in as the new input.

The ten ways this tool can order a list

Most online sorters offer alphabetical and little else. A real list is rarely just names, so each criterion below exists because a particular kind of list needs it.

  • Alphabetical: A-Z or Z-A using the alphabet of the language you pick, not a raw character-code order.
  • Natural: treats digit runs as numbers, so item2 comes before item10 instead of after it.
  • Numeric: reads the whole line as a number, so -3, 2.5 and 10 land in the order a calculator would put them.
  • Length: characters per line, counted the way a reader counts them — one emoji is one character.
  • Word count: how many words each line holds, for comparing sentence-like rows by density.
  • Month name: January before February, in your chosen language or English, long form or abbreviated.
  • Weekday name: Sunday through Saturday, so a rota sorts into week order rather than alphabetically.
  • Last word: orders people by surname without you having to rewrite the list first.
  • Reverse: flips the order the lines are already in, without sorting them at all.
  • Shuffle: randomises the order, repeatably — see below.

Which criterion for which list

  • Names, tags, titles, labels: Alphabetical.
  • Filenames, version strings, anything ending in a number: Natural.
  • Prices, scores, IDs, measurements: Numeric.
  • Finding the outliers in a list of sentences: Length or Word count.
  • Rotas, schedules, anything written as a date word: Month name or Weekday name.
  • A list of people you want ordered by family name: Last word.

Breaking ties with a second criterion

One criterion often leaves groups of equal lines. A second one decides the order inside those groups, and lines that are still equal keep the order you gave them — the sort never reshuffles them behind your back.

  • Sort by word count, then A-Z: short lines first, alphabetical within each length.
  • Sort by column 2 as a number, then column 1 as text: grouped by value, named inside each group.
  • Sort by month name, then by day column: a calendar order that a plain A-Z cannot produce.
  • Free gives you two levels. Pro removes the limit; every criterion itself is free.

Sorting by a column instead of the whole line

Pasted lists are often two or three fields wide — a name and a score, a path and a size, a date and a note. Set the column number and the delimiter, and the ordering uses that field while the whole line moves with it.

  • Column 0: the whole line. This is the default and it is what most lists want.
  • Column 2 with a tab: what you get pasting two columns out of a spreadsheet.
  • Any delimiter: tab, comma, semicolon, space, pipe, or a string you type yourself.
  • Ragged lines: a line without that many fields is grouped at the end rather than sorted as if it were empty.

Picking the delimiter

  • Tab is the default because copying two columns out of a spreadsheet gives you tabs.
  • Space works for aligned output such as a directory listing, but any value containing a space will split.
  • Comma is right for a simple list and wrong for a real CSV — a quoted field containing a comma needs the CSV sorter.
  • Custom takes any string, so a log using " | " as a separator can be sorted on its third field.

Natural order, numeric order, and why they differ

These two look similar and answer different questions. Natural order is for text that contains numbers; numeric order is for lines that are numbers.

  • Natural: file-2 before file-10, because the digit run is compared as a number while the rest is compared as text.
  • Numeric: -3 before 2.5 before 10, because the whole line is read as one value.
  • Numeric understands thousands separators, decimals and accounting parentheses, so (500) sorts as minus five hundred.
  • A line that is not a number under Numeric — N/A, or 12 kg — is grouped after the real numbers instead of being guessed at.
  • Those groups do not flip when you sort descending: unsortable lines stay at the end in both directions, the way a spreadsheet keeps blanks last.

Language rules, case, and accents

Alphabetical order is a property of a language, not of the alphabet. Getting this wrong is quiet — the list looks sorted, just not the way your reader expects.

  • Pick the language: leave it on your browser's setting, or choose one of the six so a shared list sorts identically for everyone.
  • Case is ignored by default: apple and Apple sit together, which is what almost every list wants.
  • Accents are not ignored: cafe and cafe-with-an-accent stay separate entries, because they are different words.
  • Ignore leading articles: sorts The Hobbit under H, and does the same for the articles of the other five languages.
  • Trim each line: strips leading and trailing spaces before comparing, and from the output too.

Leading articles, by language

  • English: a, an, the.
  • Spanish: el, la, los, las, un, una, unos, unas.
  • German: der, die, das, den, dem, des and the ein- forms.
  • French: le, la, les, un, une, des, and the elided l' and d'.
  • Portuguese: o, a, os, as, um, uma, uns, umas.
  • Indonesian: si, sang, para — the particles, since Indonesian has no articles as such.

Duplicates and blank lines

Both are decisions about what to keep, and both happen in a defined order: blank lines are placed first, the sort runs, then duplicates are collapsed.

  • Exact match: only fully identical lines are duplicates.
  • Ignore case: Text, TEXT and text collapse to one entry.
  • First one wins: duplicates are removed after sorting, so the survivor is the first in the sorted list, not the first in your paste.
  • Blank lines: dropped, pinned to the top, or pinned to the bottom — never mixed into the sorted body.
  • Counted, not hidden: the tool reports how many duplicates and how many blanks it removed.

What the file keeps

A sorter only changes the order of the lines. Everything else about the file should come back untouched, and that takes more care than it sounds like it should.

  • Windows line endings survive: a file that arrives with them is written back with them.
  • Old Mac endings and the Unicode line and paragraph separators are recognised too, not just the common two.
  • A file that ends with a final newline still ends with one; a paste that does not, does not gain one.
  • Force one style from the output settings when you are moving text between systems on purpose.
  • Text encodings are detected on the way in, including files saved as UTF-16 by a spreadsheet.

Text encodings

  • UTF-8 with or without a byte-order mark, which is what most editors write.
  • UTF-16, which is what a spreadsheet produces when you save as Unicode Text.
  • The mark itself is treated as metadata, not as a character, so it never appears at the front of your first line.
  • Downloads are written as UTF-8, the encoding every modern tool reads.

Reverse and shuffle

Two orderings that are not sorts at all. Reverse flips what you already have; shuffle randomises it, and unlike every other online shuffler this one can be repeated.

  • Reverse: the last line becomes the first. Nothing is compared, so it works on any list.
  • Shuffle with a seed: the same list and the same seed always give the same order.
  • Why that matters: a shuffled order you cannot reproduce cannot be shared, cited or checked by anyone else.
  • Change the seed: a different number gives a different order, on demand.

Why use a text sorter?

Turn messy pasted lists into clean, ordered rows: alphabetical for names, by length for quick scanning, or by word count when line density matters.

Benefits

  • Alphabetical: A-Z or Z-A using your chosen language's string rules.
  • By length: shortest or longest lines first.
  • By word count: order rows by how many words they hold.
  • Dedupe: optional unique lines after sorting.
  • Live preview: see sorted output while you edit.

When to use it, and when not to

Cleaning guest lists, keywords, filenames, config snippets, log extracts, or any plain-text list where the order is the point.

Ideal use cases

  • Lists: alphabetize names, titles, or tags.
  • Data prep: order lines before CSV or spreadsheet work.
  • Editing: reorder lines by size or verbosity.
  • Dedupe and sort: unique lines in a chosen order.
  • Logs: group thousands of repeated messages together in one pass.
  • Quick tasks: avoid spreadsheet formulas for one-off sorts.

When not to use it

  • When quoted fields contain your delimiter — a CSV needs the CSV sorter, which understands quoting.
  • When the file is a spreadsheet rather than text; the spreadsheet tools keep formatting and formulas.
  • When the order has to follow a rule no criterion here expresses, such as a custom priority list.

How the ordering is decided

The rules the sort follows, stated plainly, so a surprising result can be explained rather than guessed at.

Key points

  • Comparison keys are built once per line, then the lines are ordered by those keys.
  • Lines that compare equal keep the order you gave them, so a second criterion can break ties meaningfully.
  • Every criterion sorts unusable lines — blank fields, unparseable numbers, unknown month names — into their own group at the end.
  • Those groups keep their position when you reverse the direction; only the usable lines flip.
  • Length counts characters as a reader sees them, so an emoji made of several code points still counts as one.
  • The same input and the same settings always produce the same output, shuffle included.

Best practices

Five habits that make the result predictable.

Quality considerations

  • Turn on Trim each line if the ordering surprises you — a trailing space is invisible and it is compared.
  • Use Numeric, not Alphabetical, for a list of numbers; 10 sorts before 9 as text and that is correct behaviour for text.
  • Pick the language explicitly when the list will be shared, so everyone sees the same order.
  • Turn on duplicate removal only when losing repeated lines is what you want; the count tells you how many went.
  • Read the reported line counts — input, output, duplicates removed, blanks dropped — before pasting the result somewhere that matters.

Limitations, limits and compatibility

Plain text lines; rich formatting is not preserved. Free sorts one file at a time up to 25 MB — around half a million lines — and Pro raises that to 50 files at once delivered as a single ZIP, bounded by your device rather than by a fixed number. Every sort criterion, both directions, column sorting, all six sets of language rules and duplicate removal are free. Sorting runs without freezing the page, so there is no size at which the tool asks you to press a button to avoid a stall.

Powered by optimised processing algorithms.

Frequently asked questions

How does the text sorter work?

Paste one item per line, choose what to sort by, and the tool reorders the lines and updates live. It splits the input on line breaks, builds one comparison key per line, orders the lines by those keys, then puts the text back together with the line endings the file arrived with. Blank lines are dropped by default, or you can keep them at the top or the bottom.

What can I sort by?

Ten criteria: alphabetical, natural order so item2 comes before item10, true numeric order for lists of numbers, character length, word count, month name, weekday name, the last word on each line, plain reverse, and a repeatable shuffle. Every one of them runs ascending or descending, and you can add a second criterion to break ties.

Can I sort by a column instead of the whole line?

Yes. Set the column number and pick the delimiter — tab, comma, semicolon, space, pipe or your own string — and each line is ordered by that field while the whole line stays intact. Lines that do not have that many fields are grouped together at the end rather than being treated as errors.

How do I sort case-insensitively and handle accents?

Case-insensitive is the default: apple and Apple are treated as the same. Accents are respected, so cafe and cafe with an accent stay separate entries rather than collapsing into one. Turn on case-sensitive sorting if you want uppercase and lowercase ordered apart.

Which language's alphabet does it use?

Whichever you choose. Alphabetical order is not universal — Swedish puts a-ring after z while German does not — so the language rules are a control on the page rather than something taken silently from your device's settings. Leave it on your browser's language, or pick one of the six explicitly so the same list sorts the same way for everyone you share it with.

Can I remove duplicates and control blank lines?

Yes. Duplicate removal runs after the sort and keeps the first of each group, matching either exactly or ignoring case. Blank lines can be dropped, pinned to the top, or pinned to the bottom, and they never mix into the sorted body. Trim each line first if stray spaces are making identical-looking lines compare as different.

Will it break my Windows line endings?

No. A file that arrives with Windows line endings is written back with Windows line endings, and a file that ends with a final newline still ends with one. You can also force the output to one style if you are moving text between systems.

Is the shuffle repeatable?

Yes, and that is unusual. The shuffle takes a seed number, so the same list with the same seed always produces the same order — which means a shuffled list can be shared, cited and reproduced. Change the seed for a different order.

Is my text private and are there size limits?

It all runs on your device, not our servers — there is no upload and no server round trip. Free sorts one file at a time up to 25 MB, which is roughly half a million lines; Pro sorts up to 50 files at once, returns them as a single ZIP, and is bounded by what your device can handle rather than by a fixed number.

Is the sorter free, and does it work offline and on mobile?

The sorter itself is free, including every sort criterion, both directions, column sorting, all the language rules and duplicate removal. It works on phones, tablets and desktops, and once the page has loaded you can keep sorting lists without an internet connection.

Related tools

4.7out of 5

from 200 ratings

Rate this tool

Tap a star — it takes a second