Line-based list manipulation is one of those tasks that comes up more often than you'd expect in development work. Merge two lists of domain names and remove duplicates. Sort a config file's allowed IPs alphabetically. Randomize a list of test users. Clean up a list of slugs by removing entries that appear more than once. These are the kinds of small data wrangling tasks that don't warrant writing a script but take too long to do by hand — which is exactly where browser tools earn their place.
DevToolShack has two tools that handle this: the Sort Lines tool for ordering, reversing, and randomizing any line-based list, and the Duplicate Line Remover for stripping repeated entries. Used together, they handle the majority of list-cleaning tasks in seconds.
Sorting Lines: More Options Than You'd Expect
Sorting looks simple until you encounter a list that doesn't sort the way you expect. The Sort Lines tool offers several modes, each appropriate for different data:
Alphabetical (A–Z / Z–A). Standard lexicographic sort. Works correctly for lists of words, domain names, and email addresses. Note that lexicographic order is case-sensitive by default: uppercase letters sort before lowercase in ASCII order, so "Banana" sorts before "apple" without case normalization. A case-insensitive option avoids this.
Numerical. Sorts lines by their numeric value rather than their string representation. Without this, "10" sorts before "2" in lexicographic order because "1" < "2". Numerical sort puts 2 before 10 as expected. This matters for lists of version numbers, IDs, or any data where numbers appear as strings.
By line length. Useful for finding the longest or shortest items in a list, or for formatting purposes where you want items ordered by how much space they take.
Random shuffle. Randomizes the order of lines. Useful for generating random ordering of test data, picking random items from a list, or breaking alphabetical patterns in sample data.
Reverse. Inverts the current order, whatever it is. Useful after sorting to get descending order, or to flip any list.
Removing Duplicate Lines
The Duplicate Line Remover strips repeated lines, keeping only the first occurrence of each unique line. This is the browser equivalent of sort | uniq on the command line (or just uniq if the input is already sorted). A few important nuances:
Case sensitivity. "Apple" and "apple" are different strings and will both be kept by a case-sensitive deduplicator. If your list might have case variants of the same item, use a case-insensitive mode or normalize case first with the Case Converter.
Whitespace. A line with a trailing space is technically different from the same line without one. If your list was copy-pasted from a table or document, invisible trailing whitespace might prevent duplicates from being detected. Trimming whitespace before deduplicating avoids this.
Empty lines. Empty lines are technically valid entries. Depending on your data, you may want to remove them alongside duplicates or preserve them. Most tools have an option for this.
Common Workflows
Merging and deduplicating two lists. Paste both lists into a single text block (one after the other), run Duplicate Line Remover, then Sort Lines. The result is a single sorted, deduplicated list. The command-line equivalent is cat list1.txt list2.txt | sort | uniq.
Finding unique values in a dataset. Paste a column of values (domain names, user IDs, status codes from a log file), run Duplicate Line Remover, and what remains is the unique set. This is the browser equivalent of SELECT DISTINCT in SQL.
Preparing seed data. When generating test fixtures, you often want a clean, sorted, unique list of values. Sort then deduplicate gets you there without opening a spreadsheet or writing a script.
Cleaning allowlists and blocklists. Security configs, CORS origin lists, and firewall rules benefit from being sorted and deduplicated for readability and to catch unintentional duplicates that could create confusion.
Doing It on the Command Line
For automation or large files, the command line handles these operations efficiently:
# Sort alphabetically and remove duplicates
sort -u input.txt > output.txt
# Sort numerically
sort -n input.txt > output.txt
# Remove duplicates without sorting (preserves original order)
awk '!seen[$0]++' input.txt > output.txt
# Shuffle randomly
shuf input.txt > output.txt
The awk '!seen[$0]++' pattern is particularly useful when you need to deduplicate without changing the original order — it keeps the first occurrence of each line and removes subsequent ones, without sorting the output.
uniq only removes adjacent duplicate lines — it won't catch duplicates that appear far apart in the file. sort | uniq is the reliable pattern because sorting puts duplicates next to each other first. The browser-based Duplicate Line Remover handles non-adjacent duplicates directly, so sort order doesn't matter for the deduplication step.For more text manipulation tools in the same workflow, the Word Frequency Counter helps identify which items appear most often in a list before you deduplicate, and the Text Diff Checker compares two lists to show exactly what's different between them. The post on word counter and text tools covers the full set of text tools on DevToolShack.