Sort Lines Ignoring Case: Why Capitalised Rows Stop Clustering at the Top
When a column holds Apple, apple, and BANANA, a character-code sort groups every capitalised row at the top. Sorting while ignoring case produces the alphabetical order people actually expect when they scan the list.
Open the tool:Sort Lines (Ignore Case)
When case should not decide the order
Exported email lists, customer names, product tags, and file names often mix Alice with alice and iPhone with Iphone in the same column. A spreadsheet sort compares character codes, where uppercase letters come before lowercase, so every capitalised row appears first and the list looks like two separate groups.
If the list goes to someone else to review, or you are about to group it by first letter, that order reads like broken data. Re-sorting without case and pasting it back gives the expected sequence and makes it easier to compare against another list.
- Alphabetical order for emails, names, and tags
- Preparing a list before grouping by first letter
- Aligning two lists before a manual comparison
How to sort without surprises
One item per line, paste, copy back. The sort only changes order; nothing is deleted or merged, so Apple and apple end up next to each other as two separate lines. If you consider those duplicates, run a dedupe step as well.
Blank lines sort to the top because an empty string is the smallest item. A trailing newline in your input produces exactly that blank line, so delete the final newline before pasting, or drop the first row afterwards. Digits and symbols also sort by character code, which is why item10 comes before item2.
- Sorting does not merge duplicates; dedupe separately
- Remove the trailing newline so no blank row appears
- Digits sort by character, so item10 precedes item2
Where it stops, and what to use instead
It performs one case-insensitive comparison by character code and has no natural-sort mode, so numbered file names, version strings, and chapter numbers may not come out as 1, 2, 10. For that, use a tool with natural sorting or zero-pad the numbers before sorting.
It also cannot sort by pinyin, by stroke count, by a second column, or by a custom priority order. Those needs belong in a spreadsheet's custom sort, which can use multiple keys. This tool is for a one-off pass over a plain text column.
- No natural sort; numbers compare as characters
- No pinyin, stroke, or custom order
- Multi-column sorting belongs in a spreadsheet
FAQ
Why weren't Apple and apple merged after sorting?
Because sorting only reorders lines, it never deletes or merges them. Apple and apple are still two rows; ignoring case just places them next to each other. Run a dedupe tool first if you want them collapsed into one.
Why is there always a blank line at the top?
An empty string sorts as the smallest item, and a trailing newline in the pasted text counts as an empty line. Delete the final newline before pasting, or remove the first row from the result afterwards.
Is it normal that item10 sorts before item2?
Yes. Comparison is character by character, and the character 1 is smaller than 2, so item10 comes first. If you need numeric order, zero-pad the numbers to the same width first, or use a tool that supports natural sorting.
Related tool:Sort Lines (Ignore Case)