Text and IP Sorter sort
Sort lines alphabetically, numerically, or by IPv4 address, with optional duplicate removal.
What this tool does
Sorting a list sounds simple, but plain string sorting often gives the wrong answer. Numbers and IP addresses are the classic cases: sorted as text, 10 comes before 2 and 192.168.1.20 comes before 192.168.1.3, because comparison happens character by character.
This tool lets you choose the rule. Alphabetical sorting follows dictionary order, numeric sorting compares values, and IP sorting interprets each octet as a number so addresses appear in true network order. Ascending and descending order can be switched, and duplicate lines can be removed in the same pass.
When to use it
Use it to tidy a list of IP addresses extracted from access logs, to order entries for a firewall or allow list, to alphabetise configuration entries so differences are easier to spot, or to remove duplicates from a list.
Input and output examples
10
2
1
1
2
10
With numeric sorting selected. String sorting would give 1, 10, 2.
192.168.1.20
192.168.1.3
192.168.1.3
192.168.1.20
IP sorting compares each octet numerically.
Notes and limitations
IP sorting targets IPv4. Mixed IPv6 addresses or CIDR notation may not sort as expected. Trailing whitespace makes otherwise identical lines distinct, which prevents duplicate removal, so clean whitespace first. Sorting of non-Latin text follows Unicode code point order, which does not always match dictionary order in that language.
Frequently asked questions
Numbers sort in a strange order.
String sorting is selected. Switch to numeric sorting to compare by value.
Duplicates are not removed.
Invisible leading or trailing spaces make lines differ. Trim the whitespace and try again.