Clean Text · browser-local

Sort Lines

Sort a list of lines into alphabetical order. GlyphSift uses a locale-aware comparison with numeric ordering so that item 2 sorts before item 10.

Works on up to 5,000 characters and 20,000 code points per field (at most 64 code points per character), processed in your browser.

25 graphemes25 code points25 bytes

Live result

Output

apple
apple
banana
cherry

Good fit

Use this tool when

  • You want a list in predictable alphabetical order.
  • You are tidying keywords, names, or tags.
  • You need numeric-aware ordering for mixed labels.

Keep the original

Avoid it when

  • The original order carries meaning, such as steps.
  • You need to remove duplicates at the same time.
  • You require case-sensitive or custom sort keys.
01

Reviewed truth vectors

Examples that expose the edge cases

Inputbanana apple cherry apple
Outputapple apple banana cherry

Lines are ordered; duplicates are kept.

Inputitem 10 item 2 item 1
Outputitem 1 item 2 item 10

Numeric-aware order keeps 2 before 10.

InputBeta alpha
Outputalpha Beta

Base-letter comparison ignores case differences.

02

Transparent implementation

How it works

  1. 01

    Normalize line endings to LF.

  2. 02

    Split into lines and compare with a locale-aware, numeric collator.

  3. 03

    Join the sorted lines with single newlines.

03

Known limitations

What the result cannot promise

It does not remove duplicates or empty lines.

Comparison is base-letter and case-insensitive, not a strict code-point sort.

It does not sort by length or a custom key.

04

Questions before copying

Frequently asked questions

Are duplicates removed?

No. Sorting preserves every line. Run Remove Duplicate Lines separately for a unique set.

How are numbers handled?

A numeric-aware comparison is used, so item 2 sorts before item 10.

Is it case-sensitive?

No. It compares base letters, so case differences do not change the order.

05

Testing and sources

How this tool is tested

GlyphSift Editorial — Text-engine notes written and reviewed by Hommer Zhao, Founder & General Manager

GlyphSift Editorial is the site's writing and review process, led by Hommer Zhao, who is accountable for every tool page and correction. Each tool's examples are written against real Unicode edge cases and checked against the engine before the page is published.

Each tool page is reviewed against the same six input classes the engine is tested with — ASCII, emoji, combining marks, non-Latin scripts, empty input, and 5,000-grapheme input — and cannot become eligible if it is only a parameter variation of another page.

Automated evidence

  • Tool-contract & coverage suiteShared suite · 37 cases across all tools it covers

    tests/tools-30.test.mjs mirrors the ToolRunner dispatch and asserts every registered engineId returns the contracted output shape, plus a coverage guard: every style keeps one output character per input character with unmapped characters passed through in place, and strikethrough, zalgo and upside-down never drop or split a grapheme cluster.

    Run in: node --test after a production build (vinext build)
  • Rendered-HTML suiteShared suite · 26 cases across all tools it covers

    tests/rendered-html.test.mjs renders the deployed server bundle and asserts the Unicode-version manifest and each wave's tool markup are present in the server-rendered HTML.

    Run in: node --test against the built dist/server bundle
  • Transform & cleanup suiteShared suite · 38 cases across all tools it covers

    tests/transform-cleanup.test.mjs exercises each deterministic cleanup and transform action against whitespace, duplicate, ordering, casing, and HTML-to-text edge cases.

    Run in: node --test, no network, no randomness

Standards this tool follows