Search Results

    Sort Text

    Alphabetize or sort lines in different orders

    1


    Share

    What Is the Sort Text Tool?

    The Sort Text tool lets you paste a block of lines and reorder them using one of seven sorting methods: Alphabetical A-Z, Alphabetical Z-A, Natural A-Z, Natural Z-A, Character Length, Reverse Order, and Shuffle. Click whichever button matches what you need and the lines rearrange instantly. It covers most of the ways you would want to organize a list without opening a spreadsheet or writing a script.

    Having all the sort options in one place is what makes it worth keeping open. Alphabetical sorting is the obvious use, but natural sort is the one that actually handles numbered lists correctly, which is something standard alpha sort gets wrong in a way that annoys me every time I see it.

    How to Use This Tool

    1. Paste or type your text into the input box above. Each line is treated as a separate item.
    2. Click one of the sort buttons: A-Z for standard alphabetical, Z-A for reverse alphabetical, Natural A-Z or Natural Z-A for number-aware sorting, Character Length to sort by line length, Reverse Order to flip the current sequence, or Shuffle to randomize.
    3. The lines rearrange immediately when you click a sort option. No separate confirm step.
    4. Copy the result using the Copy button, or select and copy manually. Use Clear to reset the input.

    When Would You Use This?

    Alphabetizing a list of names, items, keywords, or entries before dropping it into a document, spreadsheet, or index where alphabetical order is expected.

    Sorting a numbered list correctly using natural sort, so that item 2 comes before item 10 instead of being sorted after item 19 the way standard alphabetical order would place it.

    Randomizing a list for a draw, quiz question order, or team assignment, or flipping a list into reverse order when you need the last entry to appear first without doing it manually.

    Examples

    Alphabetical sort A-Z

    Input   : banana
    apple
    mango
    kiwi

    Output  : apple
    banana
    kiwi
    mango

    Natural sort vs alphabetical sort on numbered items

    Input   : item 10
    item 2
    item 1
    item 20

    Alphabetical A-Z output: item 1
    item 10
    item 2
    item 20

    Natural A-Z output: item 1
    item 2
    item 10
    item 20

    Sort Z-A (reverse alphabetical)

    Input   : apple
    banana
    kiwi
    mango

    Output  : mango
    kiwi
    banana
    apple

    Sort by character length

    Input   : hi
    hello there
    hey
    good morning everyone

    Output  : hi
    hey
    hello there
    good morning everyone

    Shuffle

    Input   : red
    green
    blue
    yellow

    Output (one possible result): blue
    red
    yellow
    green

    (Result differs each time Shuffle is clicked)

    Frequently Asked Questions

    How do I alphabetize a list online?

    Paste your list into the input box and click the A-Z button. The lines sort into alphabetical order instantly.

    What is natural sort order?

    Natural sort treats numbers within text as actual numeric values rather than individual digit characters. So "item 10" sorts after "item 9" instead of after "item 1". Standard alphabetical sort would place "item 10" before "item 9" because it compares the character "1" before "9". For numbered lists, natural sort is almost always what you actually want.

    How do I sort lines in a text file?

    Paste the file contents into the input box, choose your sort method, copy the output, and save it back to your file.

    How do I alphabetize a list in Word?

    Select the list, go to the Home tab, and click the Sort button (it looks like AZ with an arrow). Choose ascending or descending. For plain text outside of a Word document, paste into this tool instead.

    How do I sort a list in Excel?

    Select the column, go to the Data tab, and click Sort A to Z or Sort Z to A. For plain-text lists not in a spreadsheet, this tool is faster.

    How do I sort lines in Python?

    Use sorted(lines) for ascending alphabetical, sorted(lines, reverse=True) for descending. For natural sort, use the natsort library. For a no-code option, paste into this tool.

    What is the difference between alphabetical and natural sort?

    Alphabetical sort compares characters one by one from left to right, treating digits as characters. Natural sort handles embedded numbers as numeric values. The difference only shows up when your lines contain numbers, but when it does show up, it matters quite a bit.

    Can I sort by line length?

    Yes. Click the Character Length button and lines are reordered from shortest to longest based on their character count.

    How do I randomly shuffle lines?

    Click the Shuffle button and the lines are rearranged in a random order. Click it again for a different arrangement.