Text & Utilities

Text Line Tools

Remove duplicate lines, sort, filter, trim and number lines of text.

Clean up


Order and filter
Add to each line

Tip: prefix ' and suffix ', turn a list into SQL or code values.

Input lines: 8Output lines: 5Duplicates removed: 2Empty lines removed: 1Filtered out: 0
Input
Result

About this tool

Text Line Tools treats your text as a list, one item per line, and cleans it up in one pass: remove duplicate lines, drop empty lines, trim stray spaces, sort alphabetically, naturally or by number, keep or remove lines that contain a word, and add a prefix, suffix or line number to every line.

It is the quick fix for everyday lists: email addresses exported twice, keywords collected from several tools, log lines you want to filter, or IDs you need to paste into a SQL IN (…) clause. All options apply live, so you can see the effect of each one, and the text never leaves your browser.

How to use Text Line Tools

  1. Paste your list into the Input box, one item per line, or open a .txt, .csv or .log file.
  2. Under Clean up, choose whether to trim spaces, remove empty lines and remove duplicates. Tick "Ignore case" to treat Apple and apple as the same line.
  3. Pick a sort order. "Natural" puts file2 before file10; "By number" sorts by the first number in each line; "Random" shuffles the list.
  4. Optionally type a word in the filter box to keep only matching lines, or tick the option to remove them instead.
  5. Add a prefix, suffix or line numbers, then copy or download the result. The counters show how many duplicates and empty lines were removed.

Examples

Remove duplicate lines

Input
apple
banana
apple
cherry
banana
Result
apple
banana
cherry

The first occurrence of each line is kept, so the original order is preserved.

Natural sort vs. A → Z

Input
file10
file2
file1
Result
Natural: file1, file2, file10 · A → Z: file1, file10, file2

Turn a list into SQL values

Input
Prefix ' and suffix ', on: 1001 / 1002
Result
'1001',
'1002',

Remove the last comma and wrap the result in WHERE id IN ( … ).

How the options are applied

The steps run in a fixed order: trim, remove empty lines, filter, remove duplicates, sort, reverse, and finally add prefix, suffix and numbers. Because duplicates are removed after trimming, "apple" and "apple " count as the same line when trimming is on.

Alphabetical sorting uses the language-aware collation of your browser, so accented letters sort next to their base letter (é next to e) instead of after z. Natural sort additionally compares runs of digits as numbers, which is what you want for file names, versions and chapter lists.

Frequently asked questions

Everything you need to know about this tool and data security.

Does removing duplicates change the order of my list?

No. Unless you also choose a sort order, the first occurrence of every line stays where it was and later repeats are removed.

Can I remove lines that contain a certain word?

Yes. Type the word in the filter box and tick "Remove matching lines instead". Leave it unticked to keep only the matching lines, which works like grep.

How large a list can it handle?

Lists with hundreds of thousands of lines work in a modern browser. Very large inputs update a moment after you stop typing.

Is the random shuffle truly random?

It uses an unbiased Fisher–Yates shuffle, which is fine for picking a random order or winners for fun. It is not meant for draws with legal or financial consequences.

Is my data safe when using this tool?

Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.