Free Line Sorter Online

Sort lines as you type: A to Z, natural order, by number value, length or a CSV column. Keep a header, ignore The/A, remove duplicates, reverse or shuffle.

No login. Files processed for your request and discarded. Free to use. Files processed & discarded →

Compress PDF — it's free or choose from 130+ tools

130+ Free Tools
— Files Processed
— Happy Visitors
— Pages Explored
0 Files Stored

Sort Lines Online

Part of Text tools: See all Text tools.

What is Line Sorter?

A line sorter that works as you type. Paste a list and it is sorted alphabetically, in natural order (file2 before file10), by the first number in each line, by length or by character code, in either direction. You can sort by one column of CSV or tab-separated data, keep a header row on top, ignore The, A and An, remove duplicates, move or remove blank lines, reverse the list or shuffle it. It runs in your browser.

How to use Line Sorter

  1. Paste your list in the top box, one item per line. The result updates immediately.
  2. Choose Sort by: alphabetical, natural, number value, length, character code, reverse or random shuffle.
  3. Choose ascending or descending. Case is ignored unless you tick Case-sensitive.
  4. To sort rows by a column, set Compare to the separator (comma, tab, semicolon, | or spaces) and enter the column number. Tick First line is a header to keep it on top.
  5. Copy the result or download it as a .txt file.

Why use this tool?

A plain A to Z sort puts chapter10 before chapter2, puts $1,249 before $329 and drags header rows into the data. This tool lets you pick the order that matches the list, keeps every line exactly as you typed it, tells you which lines could not be ranked and never uploads your text.

FAQ

How do I sort a list alphabetically?
Paste the list, one item per line. It is sorted A to Z straight away, ignoring upper and lower case. Choose Descending for Z to A, then copy or download the result.
Why does 10 come before 2 when I sort?
An alphabetical sort compares characters one by one, and 1 comes before 2. Choose Natural to read digits inside text as whole numbers, or Number value to sort by the number itself.
Can I sort lines by a number in the line, like a price?
Yes. Number value uses the first number in each line, including decimals, negatives, a currency sign in front and thousands written as 1,249. Lines with no number go to the end.
Can I sort CSV rows by one column?
Yes. Set Compare to comma separated and enter the column number. Quoted values that contain commas stay together. Tick First line is a header so the column names stay on top.
Is the sort case-sensitive?
Not by default: Apple and apple sit together. Tick Case-sensitive to put a capitalised word just before its lowercase form, or choose Character code to put every capital letter before every lowercase letter.
Can it sort by line length or shuffle a list?
Yes. Length orders lines by the number of characters, shortest or longest first. Random shuffle mixes the lines using your browser's secure random generator, and Shuffle again gives a new order.
Is my text uploaded?
No. Sorting happens in your browser. The text is not sent to our server, stored or logged.

What this line sorter does

Paste any list with one item per line and it is put in order straight away. There is no button to press: the result box updates as you type or paste, and a short summary under it says how many lines went in, how many came out and exactly how they were sorted. You choose what "in order" means. It can be alphabetical, natural order where file2 comes before file10, the value of a number inside each line, the length of each line, or plain character code order. You can also reverse a list or shuffle it into a random order.

Real lists often need more than a straight A to Z. A spreadsheet export has a header row that must stay on top. A price list should be ordered by the amount, not by the first letter. A list of band or book titles reads better when The and A are ignored. A CSV file needs to be sorted by its second column. Each of those is one setting here, and the original lines always come back exactly as you typed them, only in a new order.

How to sort lines

  1. Paste or type your list in the top box. Each line is one item: a name, a URL, a file name, a row of a CSV file or a whole sentence.
  2. Pick what to sort by. Alphabetical is the default and ignores upper and lower case, so apple and Apple sit together.
  3. Pick a direction. Ascending means A to Z, smallest number first or shortest line first. Descending is the opposite.
  4. If your lines have columns, set Compare to the right separator and type the column number. Tick First line is a header if the top line holds column names.
  5. Press Copy, or Download .txt to save the sorted list. Use result as input lets you sort the result again with other settings.

The sort orders explained

Alphabetical uses the sorting rules built into your browser for your language, the same rules a well-made spreadsheet uses. Accented letters sit next to their plain letters, so Émile comes between Ben and Zoe rather than after every letter of the alphabet. Upper and lower case are ignored unless you tick Case-sensitive, in which case Apple is placed just before apple and the rest of the order stays the same.

Natural order is alphabetical, but runs of digits are read as whole numbers. A plain alphabetical sort puts chapter10 before chapter2 because the character 1 comes before 2. Natural order gives chapter1, chapter2, chapter3, chapter10, chapter21, which is what people expect for file names, invoice numbers, version labels and photo names.

Number value looks for the first number in each line and sorts by its value. It understands negative numbers, decimals, thousands written with commas such as 1,249.00, and a currency sign or text in front, so Monitor $1,249.00 lands after Desk $329. A hyphen inside a code such as item-5 is not read as a minus sign. Lines that contain no number at all are not guessed at: they are moved to the end, in their original order, and the summary tells you how many there were.

Length orders lines by how many characters they have, counting an emoji or accented letter as one character. Lines of the same length are then put in alphabetical order. This is handy for finding the shortest headlines, the longest product names or keywords that will not fit a character limit.

Character code order compares the raw Unicode code of each character, the way many programming languages and command-line tools sort by default. Every capital letter comes before every lowercase letter, digits come before letters, and accented letters come after z. Use it when you need to match the order a program will produce.

Reverse simply flips the list so the last line is first, without comparing anything. Random shuffle mixes the lines using your browser's secure random number generator; every order is equally likely, and Shuffle again gives a fresh order.

Sorting by a column or a word

Set Compare to the separator your data uses: comma for CSV, tab for data copied from a spreadsheet, semicolon, the | character, or spaces to pick a word. Then enter the column or word number, counting from 1. The whole line is kept and moved; only the chosen column decides the order. For comma and semicolon data, values wrapped in double quotes may contain the separator, so "Smith, John" stays one column. Lines that do not have that many columns go to the end.

Combine this with Number value to rank rows by a numeric column, such as countries by population or products by stock level, and tick First line is a header so the column names stay on top instead of being sorted into the middle of the data.

Other options

Trim spaces at start and end is on by default, because stray spaces copied from documents push lines out of place. Blank lines are removed unless you choose to move them to the end. Remove duplicate lines keeps only the first copy of each line, ignoring upper and lower case unless Case-sensitive is ticked. Ignore The, A, An at the start sorts The Beatles under B, the way libraries and music apps file titles, while still showing the full title in the result.

When two lines are equal for the chosen sort, they stay in the order you gave them. This is called a stable sort, and it means you can sort by one thing and then another with Use result as input: sort by name first, then by department, and each department stays in name order.

Common uses

  • Putting names, guest lists, glossary terms, bibliographies and reading lists into alphabetical order.
  • Ordering file names, image names and version numbers naturally before renaming or uploading them.
  • Ranking a pasted price list, scores or totals by value, largest first.
  • Sorting CSV or spreadsheet rows by one column without opening a spreadsheet program.
  • Tidying code lists such as imports, CSS properties, environment variables or word lists into a fixed order so changes are easy to review.
  • Shuffling quiz questions, a team order or a reading rota.

Limits and what it does not do

Each line is one item, so a paragraph that wraps over several lines is treated as several items. Number value reads only the first number on a line, or in the chosen column. Dates are not sorted as dates unless they are written year first, such as 2026-11-12, in which case an alphabetical sort already puts them in date order. The tool does not sort columns inside a single line and does not edit cells; for heavier data work, convert the file with the CSV to JSON converter.

Input is capped at five million characters, roughly a hundred thousand lines of normal text, so your browser stays responsive. In testing, three hundred thousand short lines were sorted in natural order in under a second on an ordinary laptop; older phones will be slower.

Privacy

Everything happens in your browser. The list you paste is not uploaded to our server, not stored and not logged, which matters when it holds customer names, emails or internal codes. Downloading the result creates the file on your device, and closing the tab clears the text.

Related tools

Remove repeated lines and see how often each one appeared with the duplicate line remover, change capitalisation with the case converter, compare the list before and after with the text diff tool, or replace text across every line with find and replace.

Also try

Related tools that work well with this one: