Line Sorter

Sort, deduplicate and clean lines of text. Multiple sort modes, instant results, 100% in your browser.

Last reviewed: June 2026

New to this tool? Click here for instructions

Input
Sorted Output
Paste lines above to sort them.

How to Use the Line Sorter

Paste one item per line, choose a sort mode, and the output panel updates immediately. Options let you trim whitespace, remove empty lines, ignore case, and deduplicate after sorting.

  1. Choose A-Z, Z-A, Length, Numeric, Random, or Custom.
  2. For Custom mode, choose a delimiter and a zero-based column index.
  3. Use Remove Duplicates when you want only the first occurrence of each unique line.
  4. Copy or download the sorted text from the output panel.

When to Use the Tool in Real Workflows

Use it for SEO keyword lists, CSV-ish exports, URL lists, bibliography cleanup, CSS property lists, QA test data, allowlists, deny lists, and any small-to-medium text list where quick browser-only sorting is faster than opening a spreadsheet.

How It Works

The sorter splits the input on line breaks, applies the selected cleanup options, then sorts a local JavaScript array. Alphabetical and custom-column modes use string comparison, Length mode compares line lengths, Numeric mode extracts the first numeric value it can parse from each line, and Random mode shuffles with Math.random(). Your text is not sent to a server.

For implementation background, see MDN on Array.prototype.sort() and String.prototype.localeCompare().

Tips, Edge Cases, or Limitations

  • Numeric mode treats lines with no number as zero.
  • Custom column indexes are zero-based: column 0 is the first field.
  • Random mode is for casual shuffling, not cryptographic randomness or drawings.
  • Very large pasted files can be limited by browser memory and textarea performance.

Frequently Asked Questions

Paste your text into the input area, make sure the A-Z chip is selected, and the lines will be sorted alphabetically instantly. Use the Ignore Case option to treat uppercase and lowercase letters as equal.
Enable the Remove Duplicates option to keep only the first occurrence of each unique line after applying the sort order. This is useful for deduplicating keyword lists, email addresses, and other text data.
The Custom sort mode allows you to sort lines by a specific column. Choose a delimiter (comma, tab, pipe, space, or custom character) and specify the column index (zero-based). Lines that do not have enough columns are treated as having an empty value for the sort column.
Yes, the Numeric sort mode extracts the numeric value from each line and sorts in ascending numeric order. It supports integers, decimals, negative numbers, and lines with mixed text and numbers. Lines with no extractable number are treated as zero.
No, your text data is not sent to a server. The Line Sorter processes your data entirely in your browser, ensuring your privacy and security.

Quick reference

Line Sorter modes and options
ControlWhat it doesUseful for
A-Z / Z-AAlphabetical ascending or descending sort.Keywords, names, URLs, headings.
LengthShortest line to longest line.Finding outliers or overly long labels.
NumericSorts by the first number parsed from each line.Ranked lists, issue IDs, version-like notes.
CustomSorts by a selected delimiter column.CSV snippets, pipe-delimited logs, tabular text.
Cleanup optionsTrim, remove empty lines, deduplicate, or ignore case.Preparing lists before import or comparison.

Example walk-through

Sort and deduplicate a keyword list

Step 1. Paste these lines into the input panel:

banana
apple
cherry
apple
date

Step 2. Keep A-Z selected and enable Remove Duplicates.

Step 3. The output panel updates as soon as the option changes.

apple
banana
cherry
date

Step 4. Copy the output or download it as sorted-lines.txt.