Trim & Clean
What It Does
Sorts all lines alphabetically, numerically, or in reverse order.
How to Use
- Paste your text into the input area.
- Select the sort direction and mode.
- Click “Sort”.
- The output shows lines in the chosen order.
Options Explained
| Option | Description |
|---|---|
| Ascending / Descending | Sort direction |
| Case sensitive | Uppercase letters sort before lowercase when enabled |
| Trim lines before comparing | Ignore leading/trailing whitespace for ordering |
Example
Input: banana / apple / cherry → Ascending → apple / banana / cherry
Sorting compares trimmed text but keeps the original spacing for each line in the output.
About Sort Lines
The Sort Lines tool arranges every line of your text in alphabetical or reverse alphabetical order. It supports both ascending (A–Z) and descending (Z–A) sorting, with options for case-insensitive comparison and trimming whitespace before comparing. Numerical values that appear at the start of lines are sorted lexicographically by default, which works well for consistently formatted data. This tool is ideal for quickly organizing any line-based content.
Sorting text lines is a routine task in many workflows. Developers sort import statements, CSS properties, or environment variables to maintain consistent code style. Data analysts organize lists of names, product codes, or categories before further processing. System administrators sort log entries, hostnames, or configuration parameters for easier review. Teachers and researchers alphabetize bibliographies, glossaries, or reference lists.
Common Use Cases
- Alphabetizing import statements or dependency lists in code
- Sorting CSS properties within rule blocks for consistency
- Organizing name lists, glossaries, or bibliographies
- Arranging environment variables or configuration keys alphabetically
- Sorting hostnames, IP addresses, or URLs for system administration
- Ordering survey responses or category labels for analysis
What Is Line Sorting?
Line sorting is the process of rearranging the lines of a text block into a specific order — typically alphabetical (A–Z) or reverse alphabetical (Z–A). Under the hood, sorting compares strings using locale-aware collation rules, which determine how uppercase vs. lowercase letters, accented characters, and special symbols are ordered. Case-insensitive sorting treats “Apple” and “apple” as equal, while case-sensitive sorting places all uppercase letters before lowercase ones in the default Unicode order. Line sorting is one of the most common operations in data preparation, code maintenance, and document formatting.
Frequently Asked Questions
Does this tool sort numbers correctly?
Lines are sorted lexicographically (as text), not numerically. This means “10” comes before “2” because the character “1” comes before “2.” For purely numeric lists, ensure all numbers have the same number of digits (e.g., zero-padded) for correct ordering.
What does “Trim line edges” do?
When enabled, leading and trailing whitespace on each line is ignored during comparison, so “ apple” and “apple” are treated as equal. The original spacing is preserved in the output — only the sort order is affected.
Can I sort lines in a file without opening it?
This is a browser-based tool, so you need to paste the file contents into the input area. For very large files, consider using the sort command in a terminal.
Is my text sent to a server?
No. All processing happens locally in your browser. Your text is never transmitted or stored.
This tool processes your text entirely in your browser. No data is sent to any server, ensuring complete privacy for sensitive or confidential content.