Sort Lines Alphabetically

Paste a list below, one item per line, and it is sorted A-Z instantly, with numbers in natural order (2 before 10) and accented letters next to their plain letter. Switch to Z-A, sort by length or shuffle randomly, and optionally remove duplicates. Copy the result or download it as a .txt file. Everything runs in your browser, so your text is never uploaded.

Input Text

0 lines • 0 characters
Or open a text file

The file is read by your browser and never uploaded.

Sort Mode

Sort Modes Explained

A-Z (Ascending): Sorts lines alphabetically from A to Z, with accented letters next to their plain letter (é with e). Example: apple, banana, cherry

Z-A (Descending): Sorts lines in reverse alphabetical order from Z to A. Example: cherry, banana, apple

By Length: Sorts lines by their number of characters, shortest to longest; lines of equal length are sorted alphabetically. Example: cat, dog, elephant

Random: Shuffles lines in random order using your browser's cryptographic random number generator. Click again to get a different arrangement

Natural Sort: Sorts numbers naturally (1, 2, 10) instead of character by character (1, 10, 2). Perfect for filenames and version numbers

Case Sensitive: When ticked, lines are compared by character code: capitals come before small letters (A, B, a, b) and accented letters after z. When unticked, case is ignored (A, a, B, b)

Keep Empty Lines: When ticked, blank lines are kept and placed after the sorted lines. When unticked, blank lines are removed from the result

Sort lines alphabetically online, free and private

To sort lines alphabetically for free, paste your list into the Input Text box, one item per line, or click Choose File to open a text file. With the A-Z Sort Mode selected, the sorted list appears under Sorted Lines as you type. Click Copy or Download .txt to save it. The sorting happens in your browser, and the Network tab in DevTools shows that nothing is uploaded.

Sorting lines alphabetically means putting whole lines in dictionary order: the tool compares the first character of each line, then the second, and so on. Case is ignored by default, accented letters sit next to their plain letter, and numbers are read by value, so 2 comes before 10. Z-A, By Length and Random are one click away, and the tool never splits a line into words.

To drop repeated lines in one go, tick Remove duplicates, or use remove duplicate lines when you want statistics and a duplicates-only view. Blank lines can be cleaned up first with remove empty lines.

Table of Use: Sort Mode and settings

Each row shows what you paste in, the setting you change and the result. ↵ marks a line break.

Sort Lines Alphabetically settings with example input and result
TaskSettingInputResult
Alphabetize a listA-Z (default)banana↵cherry↵appleapple↵banana↵cherry
Reverse alphabetical orderZ-Abanana↵cherry↵applecherry↵banana↵apple
Sort numbered filenamesNatural sort ticked (default)file10.txt↵file2.txt↵file1.txtfile1.txt↵file2.txt↵file10.txt
Compare character by characterNatural sort untickedfile10.txt↵file2.txt↵file1.txtfile1.txt↵file10.txt↵file2.txt
Put capitals first, like code doesCase sensitive tickedbanana↵Cherry↵apple↵BananaBanana↵Cherry↵apple↵banana (unticked: apple↵banana↵Banana↵Cherry)
Keep accented words with their letterA-Z, Case sensitive untickedzebra↵école↵eagle↵echoeagle↵echo↵école↵zebra
Shortest line firstBy Lengthelephant↵cat↵dog↵birdcat↵dog↵bird↵elephant
Sort and remove repeats togetherRemove duplicates tickedpear↵Apple↵pear↵apple↵figApple↵fig↵pear
Randomise a listRandom, then Shuffle AgainAny list, one item per lineA fresh random order on every click; a short list can repeat an order by chance

Features

  • Four Sort Modes. A-Z, Z-A, By Length (shortest first, ties in alphabetical order) and Random.
  • Natural sort. On by default. Digit runs are compared by value at any length, so file2 comes before file10 and v1.2 before v1.10.
  • Case sensitive. Off by default: case is ignored and lines that differ only in case keep their order. On: character-code order, with capitals before small letters and accented letters after z.
  • Accent-aware. With case sensitivity off, é sorts next to e rather than after z.
  • Remove duplicates. Keeps the first copy of each line before sorting. Accented text written in two ways matches, and case is ignored unless Case sensitive is ticked.
  • Keep empty lines. Ticked by default: blank and whitespace-only lines go to the end. Unticked: they are dropped.
  • Fair shuffle. Random uses the Fisher-Yates method with your browser's cryptographic random numbers, so every order is equally likely.
  • Files and clean-up. Open .txt, .md, .json, .xml, .csv, .tsv or .log files; Download .txt saves sorted-lines.txt or shuffled-lines.txt. Use Output as Input sorts the result again, and Reset restores the defaults.
  • Line endings kept. Windows (CRLF) line breaks and a final line break are preserved.

Once the list is in order, label it with add line numbers, count it with the line counter, or check what changed against the original in the text diff tool. To strip numbers from a sorted, numbered list use remove line numbers, and to turn a list upside down without sorting it, use the Line mode of the string reverser.

How to Sort Lines Alphabetically Step by Step

  1. Paste your list into Input Text, one item per line, or click Choose File to open a text file.
  2. Choose a Sort Mode: A-Z, Z-A, By Length or Random.
  3. Tick or untick Case sensitive, Natural sort, Remove duplicates and Keep empty lines. Greyed-out options do not apply to the chosen mode.
  4. Read the result under Sorted Lines (or Shuffled Lines in Random mode).
  5. Click Copy or Download .txt. Click Use Output as Input to sort the result again, or Reset to start over.

Who Can Use It

Students and teachers alphabetize vocabulary lists, glossaries and reference lists. Developers sort import lists, ignore files, environment variables and dependency names so changes show up cleanly in a diff. SEO and marketing teams sort keyword and URL lists, and can fix capitals afterwards with the text case converter.

Event organisers and teachers use Random to draw a running order, pick quiz questions or split a class list. System administrators sort host and log excerpts. For a text edit that applies to every line, try find and replace, and measure the finished list with the word counter.

FAQs

How do I sort lines alphabetically online for free?

Paste your list into the Input Text box, one item per line, or click Choose File to open a text file. A-Z is the default Sort Mode, so the sorted list appears at once under Sorted Lines. Click Copy to put it on the clipboard or Download .txt to save sorted-lines.txt. No account is needed, and the text stays in your browser.

How do I sort a list in reverse alphabetical order?

Click Z-A under Sort Mode. The same rules as A-Z apply, only the order is reversed, so a list of apple, banana and cherry becomes cherry, banana and apple. Natural sort, Case sensitive and Remove duplicates all still work in Z-A. Z-A sorts the lines; to flip the current order of the lines without sorting them, use the Line mode of the string reverser instead.

How do I sort lines with numbers so that file2 comes before file10?

Leave Natural sort ticked, which is the default. Each run of digits is compared by its value, so file2.txt comes before file10.txt and v1.2 comes before v1.10. Untick it to compare character by character, which gives file1, file10, file2. Natural sort applies to A-Z and Z-A and works for numbers of any length.

How does case sensitivity affect the sort order?

With Case sensitive unticked, the default, capitals and small letters sort together, so apple, Banana and cherry stay in that order, and lines that differ only in case keep their original order. Ticking it compares character codes: every capital letter comes before every small letter, and accented letters such as é come after z.

Can I sort negative numbers or decimals by value?

Not as numbers. The tool sorts text with natural number order, so whole numbers on their own lines sort correctly (1, 9, 10, 100). The minus sign and decimal point are treated as ordinary characters, though, so -5 comes before -10, and 1.10 comes after 1.9. For columns of signed or decimal numbers, a spreadsheet is the better tool.

How do I sort lines by length or shuffle them randomly?

Click By Length to put the shortest line first. Lines of the same length are put in alphabetical order, and length is counted in Unicode code points, so 😀 counts as one character but a flag or a skin-tone emoji counts as two. There is no longest-first option. Click Random to shuffle the lines using your browser's cryptographic random number generator. The button then reads Shuffle Again, and each click reshuffles; a short list can repeat an order by chance.

What happens to blank lines and duplicates when I sort?

Keep empty lines is ticked by default: blank and whitespace-only lines are moved to the end of the result. Untick it to drop them. Tick Remove duplicates to keep only the first copy of each line before sorting; capitals are ignored unless Case sensitive is ticked, but a trailing space makes a line different, so "a" and "a " both stay.

Is it safe to sort a private list online?

Yes. The lines are sorted by JavaScript in your browser and a file you open is read on your device, so nothing is uploaded to ZipConvert or anyone else. Open the Network tab in DevTools while you paste and you will see no request. Nothing is saved either, so closing or refreshing the tab clears the text.