TodayTools

Sort lines

Put lines in order: A to Z, by number, by length or at random. Ctrl+C copies the result.

PrivateNo uploadsRuns in your browser

Donate
Try an exampleTry:

Recipe

Sort: Natural

Order
Items
Paste text to see what each step removes.
Show

How to sort lines of text

  1. Paste your lines

    Paste one item per line, or a list of numbers separated by commas or spaces.

  2. Pick an order

    Choose A to Z, Z to A, Natural, By number, Shortest first, Longest first, Random or Reverse order. Pick what each item is: a line, comma separated or space separated.

  3. Copy the sorted list

    The result updates as you choose. Press Shuffle again for a new random order, then Copy or Download.

Good to know

  • Natural order reads numbers inside the text as numbers, so file 9 comes before file 10.
  • By number sorts on the first number in each line, with commas and decimals understood. Lines without a number go to the end.
  • Blank lines go to the end so the sorted list starts with content. Add Empty lines to remove them.
  • To sort numbers like 10, 2, 33, choose Items: Comma separated. The result keeps the commas.
  • Big files are fine. Drop a text file of 50 MB or more: the work happens in the background, the page stays smooth, and Download saves the full result.

Where people use it

  • Names in A to Z order

    Sort a guest list, a class list or a contact list.

  • Numbers in the right order

    Natural sort keeps item 2 before item 10.

  • Random order

    Shuffle names for a draw, a quiz turn or team picks.

  • Remove repeats

    Keep one copy of each line after sorting.

    Remove duplicate lines online
  • Number the list

    Add 1, 2, 3 in front of each sorted line.

    Add line numbers to text

Why this one

Natural sort puts mixed lists like file 2 and file 10 in the order a person expects.

  • A to Z, Z to A, by number, by length or random.
  • Natural sort for lists with numbers.
  • Runs in your browser, nothing is uploaded.

What you can change

  • A to Z or Z to A
  • Natural number order
  • Shortest or longest first
  • Random

People find this page by searching

  • sort lines alphabetically
  • sort list online
  • alphabetical order sorter
  • sort names a to z
  • sort numbers online
  • shuffle list
  • sort lines by length
  • reverse list order
Cite this tool
  • APA
    sdev.in. (n.d.). Sort lines [Web tool]. https://www.sdev.in/tools/sort-lines
  • MLA
    "Sort lines." sdev.in, https://www.sdev.in/tools/sort-lines.
  • Chicago
    sdev.in. "Sort lines." https://www.sdev.in/tools/sort-lines.
  • BibTeX
    @misc{sdev-sort-lines,
      title = {Sort lines},
      author = {{sdev.in}},
      howpublished = {\url{https://www.sdev.in/tools/sort-lines}},
      note = {Web tool}
    }

Questions people ask

Why does item 10 come before item 2?

Plain A to Z compares letter by letter, so 1 comes before 2. Choose Natural and numbers inside the lines are compared as whole numbers.

Is the sort case sensitive?

Not by default: apple and Apple sort together. Untick Ignore case to sort capital letters first.

Can I shuffle lines in a random order?

Yes. Choose Random. The order stays the same while you work and changes only when you press Shuffle again, so you can copy it safely.

Does it sort names in other languages correctly?

Yes. Sorting follows the rules of your browser's language, so accented letters sort next to their plain letters.

Is my text uploaded anywhere?

No. Every step runs in your browser, on your own device. Nothing you paste or open is sent to a server or kept anywhere except this page.

Donate