Line Tools

Remove duplicate lines, sort alphabetically or numerically, reverse, shuffle, and trim text lines. Free, browser-based, no server required.

  • Runs in your browser
  • Your data never leaves your browser
  • Free · No Sign-Up
Keep the first occurrence of each exact line in its original order. Case and leading or trailing whitespace make lines different.
Sort lines in ascending order with the browser’s default locale. This compares text, so 10 comes before 9; use Sort Numeric to compare leading numbers.
Sort lines in descending order with the browser’s default locale. Case and accented letters can sort differently across devices.
Read the leading number with parseFloat: 10px is 10, 1,000 is 1, and 1e3 is 1000. Negative numbers and decimals work. Lines without a number sort alphabetically at the end.
Reverse the order of the input lines. Empty lines remain part of the result.
Shuffle the input lines into a random order. Every click starts from the input; the same order can occur again.
Remove whitespace from the beginning and end of each line. Keep whitespace inside a line and keep empty lines.
Remove empty lines and lines containing only whitespace. Other lines keep their original text, including surrounding whitespace.
Enter one item per line. Editing updates the count only. Choose an action to create output. Every action reads Input Lines; copy Output back into Input Lines to chain actions.
Copy the complete output. To apply another operation to this result, paste it into Input Lines first. If copying fails, select the output and copy it manually.
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Worked Examples

Remove duplicates from a list

Input:

apple
banana
cherry
apple
banana
date

After clicking Remove Duplicates:

apple
banana
cherry
date

Sort numerically

Input:

100 items
3 items
42 items
7 items

After clicking Sort Numeric:

3 items
7 items
42 items
100 items

Combine operations

You can chain operations: first Trim Lines to clean whitespace, then Remove Duplicates, then Sort A→Z. Each button reads the Input box, so copy the output back to the input between steps.

Common Use Cases

Line tools are useful for cleaning up data exports, deduplicating email lists, sorting log entries, preparing word lists, cleaning CSV columns, and any task where you need to manipulate text line by line.

How Each Button Works

Every button reads the Input box and writes the Output box; the input is never changed. To run several steps (trim, then remove duplicates, then sort), copy the output back into the input between steps.

ButtonRule
Remove DuplicatesKeeps the first copy of each line in its original order. Lines must match exactly, including case and spaces. Same result as awk '!seen[$0]++'
Sort A→Z / Z→AString.prototype.localeCompare with the browser’s default locale
Sort NumericReads each line with parseFloat; lines it cannot read go to the end, sorted A→Z
ReverseFlips the line order
ShuffleRandom order (each click differs)
Trim LinesRemoves leading and trailing whitespace from every line
Remove EmptyDeletes lines that are empty or contain only whitespace

Example: Sorting and Deduplicating a Mixed List

Input (the last line ends with a space):

banana
Apple
apple
Cherry
_x
10
9
éclair
Zebra
apple
apple 

Sort A→Z (English browser locale):

_x
10
9
apple
apple
Apple
apple 
banana
Cherry
éclair
Zebra

The order follows the locale, not byte values: lowercase and uppercase sit together, é sorts next to e, and 10 comes before 9 because the comparison is by character, not by number. A shell LC_ALL=C sort gives byte order instead:

10
9
Apple
Cherry
Zebra
_x
apple
apple
apple 
banana
éclair

Remove Duplicates on the same input drops one apple and keeps apple (trailing space) as a different line:

banana
Apple
apple
Cherry
_x
10
9
éclair
Zebra
apple 

Click Trim Lines first, copy the result back, then remove duplicates if trailing spaces should not count.

Example: What Sort Numeric Reads

1,000
v2
-3
1e3
10px
3
0x10
 4

becomes

-3
0x10
1,000
3
 4
10px
1e3
v2

parseFloat reads the leading number and stops at the first character it cannot use: 0x10 is read as 0, 1,000 as 1, 10px as 10, and 1e3 as 1000. 4 keeps its leading space. v2 does not start with a number, so it goes to the end.

Command-Line Equivalents

TaskShellDifference from this tool
Remove duplicates, keep orderawk '!seen[$0]++' file.txtSame result
Remove adjacent duplicatessort file.txt | uniqOutput is sorted
Sortsort file.txtFollows LC_COLLATE; LC_ALL=C gives byte order
Sort numericallysort -n file.txtDifferent rules for 1,000, 0x10, and 1e3
Reversetac file.txt (GNU) / tail -r file.txt (macOS)Same result
Remove blank linessed '/^[[:space:]]*$/d' file.txtSame result
Trim each linesed 's/^[[:space:]]*//;s/[[:space:]]*$//' file.txtSame result for ASCII whitespace

Limits

  • No case-insensitive mode. To ignore case, convert the text first with the Text Case Converter.
  • Lines are split on line feeds; pasted Windows line endings are normalized by the browser’s text box.
  • Alphabetical order depends on the browser’s language setting, so two machines can sort accented or mixed-case lines differently.
  • No line limit is set; the browser’s memory is the limit.

FAQ

How does duplicate removal work?

Lines are compared exactly (case-sensitive). The first occurrence of each unique line is kept, and subsequent duplicates are removed while preserving the original order of first appearances.

Is the comparison case-sensitive?

Yes. 'Apple' and 'apple' are treated as different lines. To make a case-insensitive comparison, convert your text to lowercase first using our Text Case Converter tool.

How does numeric sort work?

Each line is read with JavaScript parseFloat, which takes the leading number (10px reads as 10, 1,000 as 1, 0x10 as 0). Lines with no leading number are sorted alphabetically and placed at the end.

Is there a line limit?

No limit is set. Processing happens in your browser, so its memory is the only limit.

Is my data sent anywhere?

No. All processing runs in your browser using JavaScript. Your data never leaves your machine.