Line Sorter
All processing happens in your browser. Your data is never uploaded to any server.
- -3
- 7
- 42
- 100
- apple
- apple
- Banana
- cherry
- item1
- item2
- item10
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 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 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 Flip the direction
Click the A → Z button in the top-right to toggle between ascending and descending order. The output reverses instantly.
- 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 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
| Mode | Behaviour | Example (ascending) |
|---|---|---|
| Alphabetical | Sorts by Unicode character order with embedded numbers treated naturally (e.g. item2 before item10). Case-insensitive by default. | apple, Banana, cherry |
| Numeric | Parses 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 |
| Natural | Splits lines into text and number chunks and compares them separately so mixed alphanumeric content orders the way humans expect. | file1, file2, file10 |
| Length | Orders 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).