Sort Lines

Sort lines alphabetically.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste a list with one item per line and press Run to sort the lines A to Z. Numbers are sorted as text, not by value.

How to use

1
Step 1
Paste the lines into Input.
2
Step 2
Press Run.
3
Step 3
Copy the sorted list.

How it works

Lines are compared with the browser's locale-aware string comparison, so accented letters sit beside their base letters and capitals do not all come before lowercase. Because the comparison is textual, 10 sorts before 2. Sorting is ascending only.

Worked example

A mixed list

Input
banana Apple cherry 10 2 banana
Output
10 2 Apple banana banana cherry
Walkthrough
Digits sort before letters, 10 before 2 as text, and Apple lands before banana because case is not the first key.

Limitations

  • Ascending only; use Reverse Lines afterwards for Z to A.
  • No natural or numeric sort.
  • Duplicates are kept.

Questions

How do I sort lines alphabetically?
Paste them into Input and press Run.
Why is 10 before 2?
Lines sort as text, character by character, and 1 comes before 2.
Can I sort Z to A?
Sort first, then run Reverse Lines on the output.
Does it remove duplicates?
No. Use Remove Duplicate Lines.

Features

  • Locale-aware A to Z
  • Keeps duplicates
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Regular Expressions in 100 Seconds

    Fireship

    Fast regex refresher for text extraction patterns.

    Watch on YouTube
  • Learn Regular Expressions - Crash Course

    freeCodeCamp.org

    Regex powers many find/replace and clean-text workflows.

    Watch on YouTube
  • String

    MDN

    JS string methods that mirror case, trim, and split tools.

  • UTF-8 and BOM

    W3C

    Encoding gotchas when cleaning pasted text.