How to use this tool
- Enter one item per line, order.
- Select Update result to view the result.
- Check the method and assumptions below before using the result.
Input reference and sample values
Use the units and choices shown for each field. Sample values are provided for practice, not as recommendations.
| Input | Format and units | Sample |
|---|---|---|
| One item per line | Keep the structure and separators shown in the sample. Line breaks are retained in this input. | pear
apple
orange |
| Order | Choose Ascending / Descending. | Ascending |
Result for these sample inputs
apple orange pear
- Lines
- 3
Case-sensitive Unicode order. Duplicates and blank lines are preserved.
Select Try the example in the form to load these values and calculate them again. This replaces the current form inputs. Compare the result with the method and worked explanation below.
The method, explained
Compare lines using JavaScript string ordering, which compares UTF-16 code units. Ascending keeps lower values first; descending reverses the sorted sequence. Each line is treated as text.
The lines pear, apple and orange sort to apple, orange and pear. Text numbers such as 10 and 2 sort lexically, so 10 appears first in ascending order.
What to keep in mind
Sorting is case-sensitive, not locale-aware dictionary or numeric sorting. Duplicate entries, spaces and blank lines are preserved.
Common questions
Will numbers sort numerically?
No. Each line is text. For example, 10 sorts before 2. Use consistent zero-padding if that suits your list.
Does this remove duplicate entries?
No. Use Duplicate Line Remover when you want to retain only the first occurrence of each exact line.
Methodology maintained by ClarityKit. How these tools are built and checked.