Sort Lines

Sort lines A to Z or Z to A, with numeric-aware comparison and optional case folding.

What Sort Lines helps you do

Sort lines A to Z or Z to A with numeric-aware comparison and optional case folding. It puts a pasted list into order without opening a spreadsheet or writing a script. Numeric awareness means file2 comes before file10, which a plain character sort would get wrong.

Sorting happens locally in your browser and is not transmitted to Haivix.

How it works

Line tools split the pasted text into lines, apply one operation to the list, and rejoin it with a newline. A blank line is still a line, so it participates in sorting, numbering and shuffling unless you remove it first. The transformation runs in the browser and keeps the existing line order except where the tool's purpose is to change it. Nothing is uploaded, and the output replaces the preview rather than the source. If the input ends with a newline, the final empty line can affect a count or a shuffle; trim the input first when that matters.

How to use Sort Lines

  1. Paste the lines you want to sort.
  2. Choose ascending or descending, and whether to ignore case.
  3. Sort and check the first and last lines.
  4. Copy the ordered result.

When to use it

  • Alphabetize a list of names, files or keywords.
  • Sort a numeric list so that 10 comes after 9, not after 1.
  • Order log lines before reviewing them.
  • Sort a list of dates or version-like strings.
  • Put a checklist into a consistent order before sharing.
  • Normalize a list before deduplicating it.

When not to use it

  • Do not use it when the original order carries meaning, such as steps or timestamps.
  • Do not expect it to sort by a column in a delimited line.
  • Do not rely on locale-specific collation for every language.

Example

Sorting file2, file10, file1 ascending with numeric awareness gives file1, file2, file10. Blank lines sort before the text, so remove them first if they should not appear at the top. Equal lines keep their relative order because the sort is stable.

What you can do with Sort Lines

  • Sort ascending or descending.
  • Ignore case by default for a more natural order.
  • Compare embedded numbers by value, not character by character.
  • Preserve the original line text, including spacing.
  • Copy the ordered result.
  • Run the sort locally with no upload.

Example: check the line structure first

Paste a small sample and note how many lines it has, including blank lines and a possible trailing newline. The count explains most surprises after sorting, numbering or filtering.

Apply the operation and compare the first and last lines with the source. If the structure is right, run the full text; if not, remove the blank lines or trim the input first.

Copy or download the result and keep the original until the destination accepts it. Line tools are one-way, so the source is the only undo.

For a list pasted from a spreadsheet, check for hidden carriage returns or wrapping quotes before transforming it. A stray quote can sort differently or survive a filter that looks correct at a glance.

When the result feeds another tool, run a second pass only after confirming the first. Chaining a sort and a deduplication is safe, but chaining two numbering steps produces duplicated prefixes.

If the output is going into a version-controlled file, check the diff before committing. A blank-line or line-ending change can look like a content change in review even when the words are unchanged.

What to know before you start

  • Sorting is line-based and ignores relationships between columns.
  • Locale-specific collation, such as accents, may not match every natural-language expectation.
  • Blank lines participate in the sort.
  • It does not deduplicate or trim the lines.

Common mistakes

  • Sorting a list whose order was meaningful, such as a sequence of steps.
  • Leaving blank lines in and finding them at the top.
  • Expecting a case-sensitive order when ignore case is on.
  • Sorting delimited rows and expecting a column-based sort.

Troubleshooting

If 10 comes before 2, numeric awareness may be off or the number is part of a longer token; check the values.

If accented names look out of order, the locale collation differs from the destination.

If blank lines appear first, remove them before sorting.

If the order looks unchanged, the list may already be sorted or very short.

Related standards and documentation

  • A newline is a single line separator in Unix text; Windows files may use CRLF.
  • Modern JavaScript sorts are stable, so equal lines keep their relative order.
  • Blank lines are entries, not separators, in these transformations.
  • A trailing newline is a text convention, not content; remove it before counting lines.
Blank lines are still lines
  • Count the lines before you transform.
  • Remove blanks first when they should not participate.
  • Keep the original until the result is accepted.
  • Check the last line for a trailing newline.

Frequently Asked Questions