Sort lines A to Z and more

Paste a list and its lines are sorted A to Z, Z to A or by length, with numbers in their right order, in your browser: nothing you type is uploaded.

  • Nothing uploaded
  • As you type
  • Any language
  • Free, no sign-up

Getting ready…

Quick facts from our tests

Check it yourself: once the page has loaded, turn off Wi-Fi and mobile data, and Sort Lines still works. Your browser's network panel (F12 on a computer) lists every request the page makes: you'll see Google's ad requests, and none of them carries your text. Our code never gives your text to the ad code. How we prove it

How to sort lines

  1. Paste the list

    One item on each line.

  2. Pick the order

    A to Z, Z to A or by length.

  3. Copy the result

    Or download it.

When this tool isn't the right fit

  • You need to sort amounts, prices or decimals by value. Only whole runs of digits sort by value here: 1,000 and 3.5 are read in parts. Sort them in a spreadsheet.
  • Your dates are written day first, as 01/11/2026. They sort by the day, not the date. Write them year first (2026-11-01), or sort them in a spreadsheet as dates.
  • You need to sort a table by one of its columns. This tool sorts whole lines. Sort a table in a spreadsheet, which keeps each row's cells together.

Why use PDFGuild's line sorter

More free tools

Private like this one: nothing you type or add leaves your device.

Sort Lines: the complete guide

Alphabetical and natural order, capitals and accents, numbers and dates, Hindi and other scripts, real results and tips.

In this guide
  1. What it does
  2. Step by step
  3. How lines are ordered
  4. Real results
  5. Numbers and dates
  6. Capitals, accents and scripts
  7. Everyday uses
  8. Opening a file
  9. Privacy
  10. Long texts
  11. Tips
  12. Limits
  13. Terms explained

What the line sorter does, and when you need it

Sort Lines puts the lines of a text in order. Each line is one item: a name, a word, a file name, a product or a sentence. Choose A to Z, Z to A, shortest first, longest first or last line first, and the sorted list appears in the second box at once, ready to copy or download. The box with your own text is never changed, so you can try one order after another.

Numbers inside a line are compared by their value, so item 2 comes before item 10, which plain alphabetical order gets wrong. Lines in Hindi, Tamil and every other script sort in that script's own order. It runs in your browser: your list is never uploaded and never saved, so closing the page forgets it.

Some jobs it is made for:

  • A list of names for a class register, a guest list, a team sheet or an attendance list, A to Z.
  • File names and roll numbers with numbers in them, in the order people expect: 1, 2, 10, not 1, 10, 2.
  • Words for a glossary or an index, in alphabetical order, with the empty lines taken out.
  • Lines by length, shortest or longest first, to find the longest title or the shortest answer.
  • A list turned upside down, last line first, without sorting it.

Step by step: sorting a list

It takes a few seconds, and the same steps work on a phone and on a computer:

  1. Put your list in the top box, one item on each line. Paste it with the Paste button, with Ctrl+V, or by pressing and holding in the box on a phone. You can also type it, choose Open a text file, or drop a text file anywhere on the page. Press Try a sample to see it work on a short list of fruits first.
  2. Pick the order under Order: A to Z, Z to A, Shortest first, Longest first or Last line first. The result changes at once.
  3. Tick or untick the two boxes. Ignore capital letters is on at first, so Apple and apple sort together. Remove empty lines is on at first, so the blank lines go.
  4. Read the line under the result. It says how many lines were sorted, for example "8 lines sorted."
  5. Copy or download the result. Copy puts the whole list on your clipboard; Download saves it as a text file.

Press Try a sample: the box fills with nine lines (Mango, banana, Apple, mango, Cherry, banana, an empty line, Guava, apple) and the result is Apple, apple, banana, banana, Cherry, Guava, Mango, mango: 8 lines, because the empty line is removed. Repeated lines stay; to take them out, use Remove Duplicate Lines on the result.

How lines are ordered, exactly

The tool cuts the text at each line break and sorts the lines with the browser's own rules for comparing text, set to English with numbers compared by value. The rules are written here in full, and the same rules are checked by our tests.

PartThe ruleExample
A lineEverything between two line breaks is one item, spaces included. A Windows line break counts once apple keeps its two spaces
A to ZSymbols and punctuation first, then numbers, then letters: Latin, then Greek, then other scripts such as Devanagari#tag, 123, Émile, Ravi, रवि
NumbersA run of digits is compared by its value. A comma, a dot or a minus sign is not part of ititem 2 before item 10
Ignore capital lettersOn at first. Capitals and accents are then ignored, and lines that differ only in them keep the order they had. Off, a small letter comes before its capital, and a plain letter before its accented formOn: Apple, apple as they came. Off: apple, Apple
Equal linesLines that compare the same keep the order they hadTwo banana lines stay together
Z to AThe A to Z order turned roundZoe before adam
Shortest or longest firstBy the number of letters as you see them: a letter with its vowel sign, or an emoji, counts as one. Lines of the same length go A to Zfig, kiwi, apple, banana
Last line firstThe lines in the opposite order, not sortedb, a, c becomes c, a, b
Remove empty linesOn at first: lines with nothing in them, or only spaces, are dropped. Off, they sort to the top in A to Zb, empty, a gives a, b

Nothing inside a line is changed: no capital letters, spaces or words are added or taken away. Only the order of the lines changes, and the empty lines go when that box is ticked.

Real results from our tests

We tested Sort Lines with headless Chromium 148, the open-source browser Chrome is built on, on a Windows laptop with an Intel Core i7-1185G7 and 32 GB of memory, on 1 November 2026. Other work was running on the laptop at the same time, so times vary from run to run: each time below is the middle one of 3 runs.

Sorting is quick. It took 266 milliseconds or less to sort a list of 500,000 characters in English, in Hindi or in a mix of English, Hindi, Tamil and emoji, A to Z with capital letters ignored and empty lines removed, the most the page takes at once. Shortest first took 941 milliseconds or less on the same lists.

After a text is put in the box, the page waits 0.15 second before it works, so a burst of typing is worked on once, and 0.4 second when the text has more than 400,000 characters. So the result of 500,000 characters of English showed between 1.38 and 1.45 second after it was put in the box in our test. A result of more than 100,000 characters shows only its first 100,000 in the box, and says so, because showing a very long text is slow for the browser; Copy and Download take all of it.

Checked by our tests. Every example on this page is one of our tests, run on the page's own code. They cover numbers inside lines (2 before 10), capitals and accents with the box on and off, lines that compare the same keeping their order, empty lines, length counted in letters as you see them, and Hindi in its own alphabet's order.

Size and offline. On a first visit the page downloads about 0.1 MB for the tool: the page, its styles, its scripts and the fonts, with Google's ad code not counted. In our test we switched the network off after the page had loaded and pressed Try a sample: the result showed 0.2 seconds later or less in each of 15 runs.

Phone-sized screen. We also ran the tests on a phone-sized screen in headless Chromium (390 × 844 pixels, with touch). That is not a real phone. Every button, box and tick box was 44 pixels high or more, and the page did not scroll sideways. These tests don't cover Safari or Firefox.

Try it yourself: press "Try a sample" at the top of this page. It puts nine lines in the box: Mango, banana, Apple, mango, Cherry, banana, an empty line, Guava and apple. The result is the 8 lines from Apple to mango, A to Z, and the page says 8 lines sorted. Then choose Shortest first.

Try the sample

Numbers and dates in a list

Plain alphabetical order reads a line one character at a time, so 10 comes before 2 because 1 comes before 2. Sort Lines reads a run of digits as one number instead, which is what people expect:

  • Numbered items: item 10, item 2, Item 1, item 20, item 3 become Item 1, item 2, item 3, item 10, item 20.
  • File names: file10.pdf, file9.pdf, file1.pdf, file100.pdf become file1.pdf, file9.pdf, file10.pdf, file100.pdf.
  • Roll numbers: Roll 12, Roll 7, Roll 101 become Roll 7, Roll 12, Roll 101.

Only whole runs of digits count as numbers. A comma, a dot or a minus sign splits a number, so amounts don't sort by their value: 1,000, 200, -5, 3.5 and 10 come out as -5, 1,000, 3.5, 10, 200, because 1,000 is read as 1 and then 000, and 3.5 as 3 and then 5. To sort amounts or prices by value, use a spreadsheet's sort.

Dates sort by date only when they are written year first. 2026-11-01, 2026-01-15 and 2025-12-31 come out as 2025-12-31, 2026-01-15, 2026-11-01, which is the right order. Written day first, as most Indian forms write them, they sort by the day: 01/11/2026, 15/01/2026, 31/12/2025 stay in that order, though 31 December 2025 is the earliest. Rewrite dates as year, month and day before sorting them, or sort them in a spreadsheet as dates.

Sort Lines after its sample: the lines sorted from A to Z with the empty line removed, 8 lines sorted
Our sample lines, sorted in the browser.

Capital letters, accents and other scripts

With Ignore capital letters on, as it is at first, Apple and apple count as the same word, and so do é and e. Lines that differ only in capitals or accents keep the order they had, so the sample's Apple stays before its apple, and Ram Kumar, ram kumar and Ram kumar stay as they came. Turn it off and a small letter comes before its capital: apple, apple, Apple. An accent then counts too, after the plain letter: ea, éa, eb.

Words with accents sort with their plain letters, not at the end: Ärger, Anna, Zoe, évian, Emma become Anna, Ärger, Emma, évian, Zoe.

Hindi and other scripts sort in their own alphabet's order. मोहन, अमित, कविता, राम, आशा become अमित, आशा, कविता, मोहन, राम, following अ, आ, क, म, र. In a list with several scripts, each script keeps its own order and the scripts follow each other: symbols, numbers, then Latin letters, Greek, and scripts such as Devanagari after them.

Words such as The and A count like any other word. The Hindu, An apple and A book become A book, An apple, The Hindu: the tool doesn't skip a first The, as some library catalogues do.

Spaces at the start of a line come before letters, so apple with two spaces sorts first. If your lines have stray spaces, clean them first with Remove Extra Spaces.

Everyday uses

  • Class lists and registers. Paste the names from a sheet or a message, one to a line, and sort them A to Z for an attendance register or a result list.
  • Exam and form documents. Sort the file names of your scans (photo, signature, certificates) before you upload them, so you can tick them off in order.
  • Shopping and to-do lists. Sort a long list so repeated items sit together, then take out the repeats with Remove Duplicate Lines.
  • Glossaries and word lists. Sort words for a vocabulary list or an index, with Remove empty lines on.
  • Before comparing two lists. Sort both, then put them side by side in Text Compare: the differences stand out once the lines are in the same order.
  • Longest first. Find the longest titles in a list before printing them on labels, or the shortest answers in a set.

To number the sorted lines afterwards, put the result into Add Line Numbers. To turn a list upside down without sorting it, or to write its words backwards, use Reverse Text. To take the email addresses out of a page before sorting them, use Extract Emails.

Opening a text file

Choose Open a text file, or drop a file anywhere on the page, and the tool reads it on your device. These files open: .txt, .md, .csv, .tsv, .log, .json, .xml, .srt, .vtt, .html and other plain-text files, with up to 500,000 characters. The file's name and size appear below the box with an x; press the x to remove the file's text. The file is read on your device and never uploaded. The result can be copied, or saved as a new text file; the file you opened is never changed.

  • Letters. A file saved as UTF-8 (a byte order mark at the start is dropped) or as UTF-16 with a mark is read correctly, Hindi and Tamil included. A file that is not valid UTF-8 is read as Windows-1252, and the page says so: "This file isn't saved as UTF-8, so it was read as Windows-1252. If letters look wrong, save it as UTF-8 and add it again."
  • Windows line breaks. A Windows file stores each line break as two characters. The tool reads the pair as one line break, so a list saved on Windows sorts like any other, and the result has one line feed between lines.
  • Several files. Only the first one opens, and the page says so, for example "Opening a.txt only. Open the others one at a time."
  • Not a text file. A Word, PDF or picture file renamed to .txt is not read, and the page says it doesn't look like a text file. A file named .docx, .pdf or .rtf gets this message: "Only text files (.txt and similar) can be opened here. For a Word or PDF file, copy its text and paste it into the box."
  • Empty or too long. An empty file says it is empty. A file with more than 500,000 characters is not opened, and the page says how many characters it has.

For a Word or PDF file, open it in the program you normally use, select the text, copy it, and paste it into the box. A PDF whose pages are scans holds pictures, not text, so there is nothing to copy.

Private: your text stays on your device

Your text never leaves your device. The tool runs inside your browser and has no upload step: it never sends the text you type, paste or open anywhere, and it keeps no copy of it, so closing the page forgets it. The page's Content Security Policy lets it contact only this site and Google's ad service, which pays for the site; our code never gives your text to the ad code. You can check it yourself in your browser's network panel (F12 on a computer): sorting the lines adds no request that carries your text. The site's menu does remember the last few tools you opened, on your device.

A list is often personal: a class's names and roll numbers, customers, phone contacts or the items of an order. This tool lets you put it in order without handing it over. Our privacy policy says what we collect, and How we prove it shows how you can check our claims yourself.

Once the page has loaded, it also works with the internet switched off. In our test we switched the network off after the page had loaded and pressed Try a sample, and the result showed 0.2 seconds later or less in each of 15 runs.

Sort Lines after its sample: the lines sorted from A to Z with the empty line removed, 8 lines sorted, at a phone's size with the internet switched off by our test, between our test's bands that read "Internet switched off" and "Nothing uploaded: 0 requests sent data"
Proof from our testOn 9 November 2026, our test opened Sort Lines at a phone's size, switched the internet off and ran it on its built-in sample. It finished with no connection, and none of the page's 15 requests sent any data.How we test, and how to check it yourself

Long texts

The tool takes up to 500,000 characters at once, about 500 KB of English text. What happens when a text is longer:

  • A paste that would go over the limit is not added. This holds for Ctrl+V, for press and hold, and for the Paste button. The page says, for example: "That text is very long (550,000 characters), so it was not added. The box can hold 500,000 characters. Split it into smaller parts for faster results."
  • A file with too many characters is not opened. The page says, for example: "long.txt has 550,000 characters, more than the 500,000 counted at once. Split it into smaller parts for faster results."
  • A text that gets in some other way stays, unchanged. If text is dragged into the box, for example, it stays there, the result stays empty and the note says: "This text is very long (550,000 characters). Split it into smaller parts for faster results."

Sorting is quick. In our tests it took 266 milliseconds or less to sort a list of 500,000 characters in English, in Hindi or in a mix of English, Hindi, Tamil and emoji, A to Z with capital letters ignored and empty lines removed. The slow part is the browser showing a very long text in a box, so a result of more than 100,000 characters shows only its first 100,000, without cutting an emoji in half, and the note says so, for example "Showing the first 100,000 of 164,999 characters. Copy and Download take all of it." Copy and Download always take the whole result.

Tips

  • One item to a line. If your list is separated by commas, put each item on its own line first with Find and Replace: find a comma and a space, and replace it with \n, which stands for a new line.
  • Clean first. Stray spaces at the start of lines sort them to the top: remove them with Remove Extra Spaces before sorting.
  • Write dates year first (2026-11-01) if you want them in date order.
  • Leave Ignore capital letters on for names and words; turn it off only when capitals matter, as in some codes.
  • Sorting doesn't remove repeats. Use Remove Duplicate Lines after sorting, or before it.
  • Keep your own copy. The top box is never changed, but the page forgets everything when you close it.

Limits

  • One line, one item. It sorts whole lines. It doesn't sort the words inside a line, or the cells of a table by a column.
  • Amounts and decimals. Only whole runs of digits sort by value: 1,000 and 3.5 are read in parts. Use a spreadsheet for amounts.
  • Dates written day first don't sort by date.
  • One language's order. It uses the browser's general order for all scripts, set to English. Special orders of other languages, such as a dictionary order that treats a two-letter group as one letter, are not used.
  • 500,000 characters at once, about 500 KB of English text.
  • Text only. It doesn't open Word, PDF or spreadsheet files: copy their text first.

Terms explained

Alphabetical order
Words ordered letter by letter, as in a dictionary.
Natural order
Alphabetical order in which a run of digits counts as one number, so 2 comes before 10.
Case
Whether a letter is a capital (upper case) or small (lower case).
Stable sort
A sort that keeps lines that compare the same in the order they had.
Collation
The rules a computer uses to compare words of a language, accents and capitals included.
Line break
What Enter puts into a text. Windows stores it as two characters, and this tool counts it as one.

Frequently asked questions

How do I sort a list alphabetically?

Paste the list into the top box, one item on each line. A to Z is chosen at first, so the sorted list appears in the result box at once. Copy it, or download it as a text file.

Why does 10 come after 2?

Because Sort Lines reads a run of digits as one number, so item 2 comes before item 10, as people expect. Plain alphabetical order would put 10 first, because 1 comes before 2.

Can it sort numbers with commas or decimals by value?

Not reliably. Only whole runs of digits count as numbers: 1,000 is read as 1 and then 000, and 3.5 as 3 and then 5, so 1,000 sorts before 3.5. Use a spreadsheet to sort amounts and prices.

Can it sort dates?

Yes, when they are written year first, such as 2026-11-01. Dates written day first, such as 01/11/2026, sort by the day, not by the date. Rewrite them year first, or sort them in a spreadsheet.

Does it sort Hindi and other scripts?

Yes. Lines in Hindi, Tamil and other scripts sort in their own alphabet's order: अमित, आशा, कविता, मोहन, राम. In a mixed list, Latin letters come first and other scripts after them.

What does Ignore capital letters do?

With it on, as it is at first, Apple and apple sort as the same word, and accents are ignored too, so lines that differ only in them keep their order. With it off, a small letter comes first: apple, then Apple.

Does it remove repeated lines?

No. Repeated lines stay and sit together after sorting. To take them out, put the result into Remove Duplicate Lines.

What happens to empty lines?

With Remove empty lines on, as it is at first, lines that are empty or hold only spaces are dropped. With it off, they are kept and sort to the top in A to Z order.

How do I reverse the order of a list?

Choose Last line first. The lines come out in the opposite order, without being sorted. Z to A is different: it sorts the list and then turns it round.

How is the length of a line counted?

In letters as you see them: a Hindi letter with its vowel sign, or an emoji, counts as one. Lines of the same length are put A to Z.

Is Sort Lines free?

Yes. There is no sign-up and no watermark, and you can use it as often as you like. Ads from Google help pay for the site. They are kept apart from the tool, and our code never gives them your text.

Is my text uploaded anywhere?

No. The tool has no upload step: it works inside your browser and never sends the text you type, paste or open anywhere, and it keeps no copy of it. Google's ad code is on the page, and our code never gives it your text. How we prove it shows how to check.

How much text can it take at once?

Up to 500,000 characters, about 500 KB of English text. A paste or a file that would go over is not added, and the page says so. In our tests it took 266 milliseconds or less to sort a list of 500,000 characters in English, in Hindi or in a mix of English, Hindi, Tamil and emoji, A to Z with capital letters ignored and empty lines removed. See Long texts.

Can I open a text file, or a Word or PDF file?

A text file, yes: choose Open a text file or drop a .txt, .csv or similar file on the page, with up to 500,000 characters. A Word or PDF file must have its text copied out first, because the tool reads text, not those files.

Does it work offline?

Yes, once the page has loaded. In our test we switched the network off after the page had loaded and pressed Try a sample: the result showed 0.2 seconds later or less in each of 15 runs. If you open the page for the first time with no internet, it can't load.

By the PDFGuild team · Updated · How we test