Skip to content

Line Sorter

In-browser only Stable sort Up to 100,000 lines
Input11

All processing happens in your browser. Your data is never uploaded to any server.

Sorted output11
  1. -3
  2. 7
  3. 42
  4. 100
  5. apple
  6. apple
  7. Banana
  8. cherry
  9. item1
  10. item2
  11. item10
Cleanup
Copied to clipboard

Overview

Sort any list, instantly

The Line Sorter handles everything from alphabetical lists to version numbers and filenames. Four sort modes, ascending or descending direction, and optional cleanup options work together so you go from messy input to a clean, ordered result without leaving the browser.

Guide

How to use Line Sorter

  1. 1
    Paste or type your list

    Enter your text in the input area on the left. Each line is treated as a separate item to sort. A sample list loads automatically when you open the tool.

  2. 2
    Choose a sort mode

    Select Alphabetical, Numeric, Natural, or Length from the tab strip at the top. The sorted result updates immediately in the output pane.

  3. 3
    Flip the direction

    Click the A → Z button in the top-right to toggle between ascending and descending order. The output reverses instantly.

  4. 4
    Apply cleanup options (optional)

    Use the Trim whitespace, Remove empty, and Remove duplicates switches below the panes to clean your list before sorting. Changes take effect immediately.

  5. 5
    Copy or download the result

    Click "Copy sorted text" to copy the output to your clipboard, or "Download .txt" to save it as a UTF-8 text file named sorted-lines.txt.

Reference

Sort modes compared

Sort modes compared
ModeBehaviourExample (ascending)
AlphabeticalSorts by Unicode character order with embedded numbers treated naturally (e.g. item2 before item10). Case-insensitive by default.apple, Banana, cherry
NumericParses each line as a decimal number and sorts by value. Non-numeric lines are grouped at the top (ascending) or bottom (descending).-3, 7, 42, 100
NaturalSplits lines into text and number chunks and compares them separately so mixed alphanumeric content orders the way humans expect.file1, file2, file10
LengthOrders lines by character count (UTF-16 code units). Ties preserve the original input order (stable sort).a, bb, ccc, dddd

Tips

Common mistakes to avoid

  • Forgetting to trim whitespace

    A line starting with a space sorts before any line starting with a letter. Enable "Trim whitespace" to strip leading and trailing spaces before sorting.

  • Using Alphabetical mode for pure number lists

    Alphabetical mode treats 10 as coming after 2 unless the numbers are embedded in text. Switch to Numeric mode for lists of standalone numbers.

  • Expecting Numeric mode to handle mixed text and numbers

    Numeric mode groups non-numeric lines at the top or bottom. Use Natural mode if your list mixes text and numbers in the same line (e.g. version strings).

Frequently asked questions

Does my data get sent to a server?
No. All sorting, cleanup, and export operations run entirely in your browser. Your text is never uploaded, stored, or transmitted. You can verify this by disconnecting from the internet after the page loads — the tool still works.
How accurate is the sorting?
Sorting is exact for all standard use cases. Alphabetical and Natural modes use the browser’s built-in Unicode comparison, which handles most languages correctly. Numeric mode parses standard decimal numbers (including negatives). The one limitation is that locale-specific collation rules (e.g. Spanish Ñ, German ß) are not applied.
How does natural sort work?
Natural sort splits each line into alternating text and number chunks. It compares text chunks alphabetically and number chunks numerically, so "file2" always comes before "file10". This is what you expect when sorting filenames, version numbers, or mixed alphanumeric labels.
How many lines can I sort at once?
The tool handles up to 100,000 lines or 5 MB of text, whichever comes first. Performance is smooth for most real-world lists. Larger inputs show an error message prompting you to reduce the input size.
What happens to duplicate lines?
When "Remove duplicates" is enabled, only the first occurrence of each unique line is kept. The comparison is case-insensitive, so "Apple" and "apple" are treated as duplicates. You can see how many lines were removed by comparing the input and output line counts.
Why does my sorted list look unexpected?
Common causes: (a) Leading spaces — a line starting with a space sorts before any line starting with a letter; enable "Trim whitespace" to fix this. (b) Case sensitivity — by default, case is ignored; toggle "Case sensitive" on if you need strict ordering. (c) Mixed numbers and text — use Numeric mode for pure number lists, or Natural mode for mixed content.
What browsers are supported?
All modern browsers: Chrome, Firefox, Safari, and Edge (latest two major versions). No extensions or plugins are required.
Why are some lines grouped at the top in Numeric mode?
Lines that cannot be interpreted as numbers (e.g. "apple", "item-1") are grouped in their original order at the top of ascending results or the bottom of descending results. A warning indicator shows how many lines were treated as non-numeric.
Can I sort by a specific column in a CSV file?
Not yet. The tool sorts complete lines only. Column or delimiter-based sorting is a candidate feature for a future update.
Is there a limit on line length?
Individual lines can be up to 10,000 characters and will be displayed and sorted correctly. Longer lines wrap in the output display.