Sort Lines

Sort lines of text A to Z, Z to A, by number or by length, with case-sensitive, trim and remove-duplicates options.

No uploadsNo sign-upInstant results
Smart SortingLive Sorting100% Local • Zero Uploads
Download
Offline engine ready100% private in-browser workspace • Zero cloud uploads
100% Private • Zero Server File Uploads

Why Use Utiliome's Free Sort Lines?

Built from the ground up for strict privacy, instant execution, and zero friction. No subscriptions, paywalls, or account registrations required.

Alphabetical, Numeric and Natural Sorting

Sorts lines alphabetically (A-Z, Z-A), numerically (item 2 before item 10), by line length, or in reverse.

Deduplication & Whitespace Controls

Optionally trim whitespace, strip duplicate lines, and enforce case sensitivity during sorting.

Locale-Aware Natural Numeric Sorting (Intl.Collator)

Uses Intl.Collator with { numeric: true } in Natural Sort mode so "file2.txt" comes before "file10.txt" and "v1.9" comes before "v1.10".

Multi-Mode Ordering: Alphabetical, Numeric, Length & Reverse

Sort lines A→Z, Z→A, numerically by value, naturally by embedded digits, or by character length from shortest to longest.

Utiliome vs Traditional Cloud Alternatives

Compare our local-first WebAssembly engine against legacy cloud tools.

Feature Utiliome (Local Browser) Legacy Cloud Converters
Natural Alphanumeric Sorting Uses Intl.Collator { numeric: true } so item2 sorts before item10 ASCII code-unit Array.sort() which places item10 and item100 before item2
Unicode & Diacritic Collation Follows Unicode Collation Algorithm (UCA) so é sorts next to e, not after z Sorts by raw UTF-16 code point, pushing all accented letters to the bottom after z
Sort by Line Length & Deduplicate Includes Sort by Length, Numeric value sort, Case-Insensitive toggle & Deduplication Basic A–Z and Z–A buttons only
100% Local In-Browser Execution Sorts tens of thousands of rows in milliseconds in browser RAM with zero uploads Uploads pasted lists and data tables to remote backend servers
How it works

How to Use Sort Lines in 3 Easy Steps

No software installation required. Everything runs directly inside your web browser.

1

Input List or Text File

Paste raw lines into the editor or drop a plain-text document.

2

Select Sort Mode and Options

Choose Alphabetical, Natural Numeric, Length, or Reverse sorting with optional deduplication and whitespace trimming.

3

Copy or Download Output

Review the sorted output and copy it to your clipboard or download as a text file.

Sort Lists Alphabetically, Numerically or Naturally

Quick Answer: Utiliome orders multi-line lists in O(N log N) time using ECMAScript Timsort paired with the browser Intl.Collator API (Unicode Collation Algorithm UTS #10), supporting strict ASCII/code-point sorting, locale-aware alphabetical sorting, natural alphanumeric sorting (numeric: true), and line-length ordering. All computation executes 100% locally in your browser with zero server uploads.

Organizing raw text lists—such as CSS property declarations, dictionary terms, or dependency lists—improves readability and makes diffing easier. The line sorter arranges lines into predictable alphabetical, numerical, or length order:

Given this unorganized list of items:

item 10
item 2
Apple
banana
Apple
item 1

Sorting in Natural Numeric mode with deduplication and trimming enabled produces:

Apple
banana
item 1
item 2
item 10

Natural numeric sorting ensures multi-digit numbers sort logically (e.g., item 2 before item 10) instead of ASCII character ordering where 10 precedes 2.

Sorting Rules: Case, Accents and Unicode

Quick Answer: Unlike default JavaScript Array.prototype.sort()—which compares UTF-16 code units lexicographically and places "10" before "2" and lowercase "a" (0x61) after uppercase "Z" (0x5A)—our comparator options handle numbers, accents, and casing naturally. All computation executes 100% locally in your browser with zero server uploads.

Keep these sorting standards in mind when processing complex lists:

  • Natural numeric vs. standard alphabetical: In standard A-Z alphabetical mode, strings are compared character by character, causing item 10 to precede item 2. Switch to Natural Numeric mode to compare embedded numbers mathematically.
  • Length-based sorting: The Length Ascending and Length Descending modes sort lines by their total character count, making it easy to organize keywords or code lines by visual density.
  • Deduplication integration: Enabling Remove Duplicates drops repeated lines while sorting. For lists that only need de-duplication, use Remove Duplicate Lines.

Lexicographical (ASCII) vs Natural (Intl.Collator) vs Numeric Sort Comparison

Quick Answer: Default ASCII/UTF-16 sorting compares strings character by character from left to right (placing "100" before "2" because "1" < "2"), whereas Natural Sort (Intl.Collator numeric: true) parses contiguous digit runs as integers. All computation executes 100% locally in your browser with zero server uploads.

Compare how the same 5-line input list is ordered across different sorting algorithms:

Input List ASCII / UTF-16 Code Unit Sort Alphabetical (Case-Insensitive) Natural Sort (numeric: true) Line Length Sort
Chapter 10 Chapter 1 chapter 1 Chapter 1 Chapter 1 (9 chars)
chapter 2 Chapter 10 ('1' < '2'!) Chapter 10 chapter 2 chapter 2 (9 chars)
Chapter 1 Épilogue (After z!) chapter 2 Chapter 10 Épilogue (8 chars -> 1st)
Épilogue chapter 2 ('c' > 'C'!) Épilogue (É ≈ E) Épilogue Chapter 10 (10 chars)

Combine sorting with our companion line utilities: Remove Duplicate Lines, Remove Empty Lines, Reverse Lines, Shuffle Lines, and CSV Sorter.

Algorithmic Stability (Timsort) & Unicode Collation Algorithm (UTS #10)

Quick Answer: Modern JavaScript engines (V8, SpiderMonkey, JavaScriptCore) implement stable O(N log N) Timsort for Array.prototype.sort(), guaranteeing that two lines comparing as equal under Case-Insensitive or Line-Length rules preserve their original relative order. All computation executes 100% locally in your browser with zero server uploads.

Why does sorting stability matter when processing structured text lists?

  1. Stable Tie-Breaking (ECMAScript 2019+): When sorting lines by character length or case-insensitively, Timsort guarantees O(N log N) worst-case complexity (O(N) on nearly sorted data) and preserves relative input order for tied rows.
  2. Multi-Column CSV Sorting: If your dataset has comma- or tab-separated columns and you need to sort by a specific column (such as Price or Date) while keeping headers pinned at the top, use our CSV Sorter.
FAQ

Sort Lines FAQ and Technical Guide

Everything you need to know about using Utiliome's free online sort lines alphabetically.

Why does item 10 sort before item 2 in standard A-Z mode?

Standard alphabetical sorting evaluates characters from left to right. Because "1" comes before "2", "item 10" precedes "item 2". Select Natural Numeric mode to sort numbers mathematically.

How does the deduplicate option work during sorting?

When Remove Duplicates is active, the first occurrence of each line is kept and later repeats are dropped before sorting, so the output contains only unique entries.

What is natural sort order, and when should I use it?

Natural sort treats digit sequences as numbers, so file2 comes before file10. Plain alphabetical sort compares character by character and would put file10 before file2. Use natural sort for filenames, version numbers, chapter lists and anything else that mixes words and numbers.

Can I sort a CSV or spreadsheet export with this tool?

You can sort any text line by line, but a CSV file is sorted by the whole line, not by a chosen column. To sort by a specific column while keeping rows intact, use the CSV Sorter.

Why do other sort tools put "10" before "2" and uppercase words before lowercase words?

Basic tools call JavaScript's default array.sort() with no comparator, which compares raw UTF-16 code units: character "1" (code 49) comes before "2" (code 50), and all uppercase ASCII letters (65–90) come before lowercase letters (97–122). Utiliome uses Intl.Collator to sort naturally.

Can I remove duplicate lines and blank lines at the same time as sorting?

Yes. Toggle the deduplicate and ignore empty lines options to perform an atomic sort + unique pass (equivalent to Unix "sort -u" with blank-line filtering).