Line Sorter Tool
Paste your lines and choose how to sort them — alphabetically, numerically or by length.
Result
How it is calculated
Each line of the pasted text is one item. Lines that are empty or contain only spaces are dropped first, so the count excludes them. With duplicate removal on, only exact repeats are removed and the first one is kept; the comparison is case-sensitive and counts spaces, so a and a (with a trailing space) are different lines. The sort mode then applies. Alphabetical (A to Z or Z to A) compares the raw characters, so every capital letter comes before every lower-case letter and accented letters such as é or ö come after z. Numeric modes compare the number at the start of each line (10 apples counts as 10); a line without a leading number counts as 0. Length mode orders by the number of characters, shortest first, and keeps the original order of lines of equal length. The output shows the sorted lines and how many remain.
Worked example
Paste four lines: 10 apples, 9 pears, 2 kiwis and 100 figs, choose numeric ascending with duplicates kept. The tool reads the leading number of each line (10, 9, 2, 100) and orders by value, so the output, one line per row, is:
2 kiwis 9 pears 10 apples 100 figs
The count is 4. In plain alphabetical mode the same lines come out as 10 apples, 100 figs, 2 kiwis, 9 pears, because "1" sorts before "2" as a character.
Common mistakes
- Using alphabetical mode on numbers. As text, 100 sorts before 9 and 10 before 2.5, because lines are compared character by character; choose a numeric mode for values.
- Expecting a case-insensitive sort. Apple and Banana come before apple and banana, so a list mixing capitals and lower case may look out of order until you make the case uniform.
- Expecting duplicate removal to ignore case or spacing.
apple,Appleandappleare three different lines for the tool, and all three stay. - Using a numeric mode on lines that do not start with a number, such as
item 10anditem 9. They all count as 0, so their order does not change; use alphabetical mode or remove the prefix. - Expecting accented words to sort like their base letters. In alphabetical mode éclair comes after zebra, because the comparison is by character code, not by a language's dictionary order.
About this calculator
Sorting a block of text line by line is a small but constant chore in data cleanup: alphabetical sorting arranges lines by their Unicode/character order, numerical sorting reads the leading number in each line and orders by its value rather than as text (so "10" correctly comes after "9" instead of before it), and sorting by length orders lines from shortest to longest — each useful for a different kind of list.
This tool takes any pasted block of lines, sorts them by your chosen method, and can optionally strip out duplicate lines in the same pass. Developers cleaning up log files or config lists, spreadsheet and CSV users prepping data before import, and writers organizing lists — like alphabetizing a bibliography or de-duplicating an email list — use it instead of writing a one-off script for a task that takes seconds in a browser.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Thousands separators trip up the numeric modes. A line starting with 1,200 is read as 1, because the number stops at the comma, so it lands near the smallest values instead of near 1200. Strip the commas from the numbers before pasting, and place numeric fields at the start of each line. What kind of lists do you usually sort here: logs, names or figures?