Text Cleanup

Sort Alphabetically (A-Z)

Organize your list items in alphabetical order.

Explanation

Sorting makes it easier to scan lists and find specific items manually.

Examples

Unsorted Fruit
Input
Banana
Apple
Cherry
Output
Apple
Banana
Cherry

Code Examples

JavaScript
const sorted = input.split('\n').sort().join('\n');

Try it Now

💡 Tips

  • Decide if case should matter (localeCompare is better for names)
  • A-Z is standard, but reverse (Z-A) is often useful
  • Remove empty lines before sorting

⚠️ Common Pitfalls

  • Standard sort() puts "Z" before "a" because of ASCII codes