Sort Lines
Sort text lines alphabetically — supports Bangla collation and multiple sort modes.
How to Sort Text Lines
- 1
Paste text
Paste your text lines into the input box.
- 2
Select mode
Choose alphabetical, by length, reverse, or Bangla collation order.
- 3
View result
Sorted lines appear instantly in the output box.
- 4
Copy result
Click Copy to send the sorted text to your clipboard.
- 1
Paste text
Paste your text lines into the input box.
- 2
Select mode
Choose alphabetical, by length, reverse, or Bangla collation order.
- 3
View result
Sorted lines appear instantly in the output box.
- 4
Copy result
Click Copy to send the sorted text to your clipboard.
Sort Lines Features
When You Need to Sort Lines
Data Organization
Sort CSV data, keyword lists, or any text data alphabetically for easier scanning and analysis.
Content Management
Sort blog post titles, category names, or tag lists alphabetically for consistent presentation.
Bangla Text Sorting
Sort Bangla text using proper Bengali collation rules — essential for dictionaries, indexes, and directories.
Log File Analysis
Sort log entries by line length to find unusual entries, or reverse order to see latest events first.
Understanding Bangla Line Sorting
Sorting Bangla text correctly requires locale-aware collation. This tool uses the JavaScript Intl.Collator API with the bn-BD locale, which implements the Unicode Collation Algorithm for Bengali. This ensures vowels sort in their proper order (অ, আ, ই, ঈ, উ, ঊ, ঋ, এ, ঐ, ও, ঔ) and consonants follow the standard Bengali alphabet (ক, খ, গ, ঘ, ঙ, চ, ছ, জ, ঝ, ঞ...).
The sort is stable, meaning lines that compare as equal retain their original relative order. This is important when sorting data with duplicate keys — you do not lose the original sequence of equal elements. For length-based sorting, the tool counts characters (including spaces) per line and orders them from shortest to longest, or vice versa.
Common Sorting Problems & Fixes
| Problem | Cause | Fix |
|---|---|---|
| Bangla text sorts in unexpected order | The bn-BD collation may handle conjuncts or vowel signs differently than you expect from visual inspection. | The bn-BD locale follows the Unicode Collation Algorithm, which is the international standard. If you need a different order, you may need a custom sort — but for most use cases, bn-BD is correct. |
| Numbers sort after letters instead of before | The default collation may treat numbers differently depending on locale settings. | If you need numbers to sort first, try sorting with a different approach or prefix lines with a sortable key. The tool uses standard locale collation which prioritizes alphabetical rules. |
| Empty lines appear at the top after sorting | Empty lines sort before non-empty lines in ascending alphabetical order. | Enable the "Remove empty lines" option before sorting to strip blank lines, or use reverse sort to push empty lines to the bottom. |
| Reverse sort does not produce exact reverse of original | Reverse sort reverses the alphabetical sort order, not the original input order. | To reverse the original input order (not alphabetical), use the "Reverse original order" mode instead of Z→A sort. These are two different operations. |
Frequently Asked Questions
How does Bangla alphabetical sorting work?
The sorter uses the bn-BD locale for Intl.Collator, which ensures proper Bengali alphabetical ordering. Bangla vowels are sorted in their correct order (অ আ ই ঈ উ ঊ...) and consonants follow the standard Bengali alphabet sequence.
What is the difference between A→Z and Z→A?
A→Z sorts lines in ascending alphabetical order (A comes first). Z→A sorts in descending order (Z comes first). For Bangla, A→Z starts with অ and Z→A starts with হ.
Can I sort by line length?
Yes. Choose "Shortest first" or "Longest first" to sort lines by their character length instead of alphabetical order. This is useful for organizing data by complexity or size.
Does the sort preserve duplicate lines?
Yes. The sorter does not remove duplicates. If you want to remove duplicates, use the Remove Duplicate Lines tool first, then sort.
Why does my Bangla text sort differently than I expect?
Bangla collation follows the Unicode Collation Algorithm with bn-BD locale rules. Conjuncts (যুক্তাক্ষর) and vowel signs may affect sort order in ways that differ from simple character-by-character comparison. The bn-BD collation is the standard used by libraries and databases.
Can I sort mixed Bangla and English text?
Yes. When sorting mixed-language text, the collation algorithm places Bangla and English characters in separate ranges. Typically, Latin characters sort before Bengali characters in the default bn-BD locale. Lines starting with numbers usually sort before both.
Is this Sort Lines tool free?
Yes, completely free. No registration, no daily limit, no line cap. All sorting happens in your browser — there is no server-side processing. You can use it unlimited times for personal, educational, or commercial work.
Can I sort CSV or TSV data?
Yes. The sorter works on any text where each line is a separate record. Paste your CSV or TSV data and sort alphabetically by the entire line content. Note that the sort is based on the full line, not individual columns — for column-specific sorting, extract the target column first.