Sort text lines
Sort your lines as text or numbers.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Sort pasted lines as text or exact decimal numbers, in ascending or descending order. Whole lines and duplicate entries are kept. Equal values stay in their original order, and empty or whitespace-only lines go last in both directions.
How to use this tool
- Paste one item per line into “Text”, or load the numeric example.
- Choose Unicode lexical order or exact decimal values, then choose ascending or descending.
- Select “Sort lines” and check the order. Use “Copy result” for the complete text, or download result.txt as UTF-8.
Supported inputs and limits
Paste up to 1 MiB (1,048,576 UTF-8 bytes), including spaces and line breaks. This is a byte limit, so emoji and other multibyte characters use more than one byte.
Numeric mode requires one decimal number per nonblank line. Signs, decimal points and scientific notation such as -2, .5 or 1e3 are accepted; labels, grouping commas and hexadecimal numbers are not. An exponent must be between −1,000,000 and 1,000,000.
Text mode compares raw UTF-16 units and is sensitive to case and surrounding spaces. Unpaired UTF-16 surrogates are rejected. CRLF, CR and LF all separate lines; the result uses the first line-ending style found in the input.
Worked example
Example input
9007199254740993 2 -1 1.01
Example options
{
"mode": "numeric"
}Example output
-1 1.01 2 9007199254740993
When something does not work
Keep your source text. For numeric errors, correct the number or exponent on the affected line, or choose text order for labels. Shorten input above 1 MiB and sort again. A failed run clears the previous result; editing or cancelling can leave older output visible, so run again and check it before copying or downloading.
Frequently asked questions
Is my pasted text uploaded?
The sorting runs in your browser. Switching tools in the same tab can temporarily retain inputs and some results, but this workspace has capacity limits. Refreshing or closing the tab clears it. Keep your source and copy or download any result you need.
What should I check in this result?
In ascending text order, “10” comes before “2” because complete lines are compared as UTF-16 strings. In ascending numeric order, 2 comes before 10, and decimal digits and exponents are compared without rounding large integers. Numeric comparison ignores surrounding spaces but keeps the original line text. Spellings with equal values, such as 2 and 02, stay in their input order; no duplicates are removed.
How do I save the full result and apply later changes?
The page previews the first 4,000 Unicode code points; “Copy result” and result.txt contain the complete sorted text. Empty input produces an empty result and a zero-byte TXT file. After editing text or options, select “Sort lines” again before using the output. Loading the numeric example changes the mode but keeps your current direction, so select Ascending to match the displayed example.
Documentation & further reading
Related tools
TXT to UTF-8
Read a TXT file with the right source encoding and save it as UTF-8.
Merge TXT files
Combine TXT files in your chosen order and save one UTF-8 text file.
Word counter
Words, characters, and paragraphs at a glance.
Case converter
Change pasted text to uppercase, lowercase or simple capitalized forms.