Text Sorter
{{ sortedLines.length }} sorted item{{ sortedLines.length === 1 ? '' : 's' }}
{{ sortModes[sort_mode] }} · {{ sepOptions[normalizeSepKey(input_sep)] }} to {{ sepOptions[normalizeSepKey(output_sep)] }}
Unique {{ uniqueCount }} Source {{ rawLines.length }} Locale {{ localeDisplay }} Output {{ sortedLines.length }}
Text sorter inputs
Paste one list, e.g. filenames or titles; use Input separator for comma, tab, or space token streams.
{{ sourceMetaLabel }}
{{ sourceActionHint }}
Use Natural for File2/File10-style names; Shuffle can use the seed below.
{{ case_sensitive ? 'A and a sort/filter as different letters.' : 'A and a share one comparison key.' }}
{{ case_sensitive ? 'On' : 'Off' }}
Examples: en-US, fr, de; keep fixed for reproducible accented-letter order.
{{ localeDisplay }}
Use New Line for one-item-per-line lists; switch separators only for token streams.
New Line is safest for lists; comma, semicolon, tab, or space create paste-ready strings.
{{ unique ? 'Only the first matching sorted item is kept.' : 'Repeated filenames, titles, or tokens stay visible.' }}
{{ unique ? 'On' : 'Off' }}
{{ ignore_blank ? 'Empty split items are removed before sorting.' : 'Empty items remain as sortable blank entries.' }}
{{ ignore_blank ? 'On' : 'Off' }}
{{ trim_lines ? 'Leading and trailing spaces are trimmed first.' : 'Original edge spacing stays in each item.' }}
{{ trim_lines ? 'On' : 'Off' }}
{{ collapse_internal_ws ? 'Runs of spaces and tabs become one space.' : 'Internal spacing stays exactly as entered.' }}
{{ collapse_internal_ws ? 'On' : 'Off' }}
{{ strip_leading_numbers ? 'Prefixes like 1), 2., or 3- are stripped.' : 'Numbered-list prefixes stay in the sort text.' }}
{{ strip_leading_numbers ? 'On' : 'Off' }}
{{ ignore_articles ? 'Titles such as The Matrix sort under Matrix.' : 'Leading articles stay part of the sort key.' }}
{{ ignore_articles ? 'On' : 'Off' }}
Example: .jpg keeps matching filenames; leave blank to include all items.
Example: draft removes draft-labelled entries; leave blank to exclude nothing.
Example: - creates a markdown bullet prefix; leave blank for no prefix.
Example: (checked) marks every sorted item; leave blank for no suffix.
{{ line_numbers ? 'Numbers match final output length, e.g. 001.' : 'Output items keep their original text without indexes.' }}
{{ line_numbers ? 'On' : 'Off' }}
Example seed: release-v1-order; blank uses the browser's current random order.
Use LF for Unix/macOS, CRLF for Windows files, CR only for legacy targets.
Keep No regex filter unless you need pattern matching beyond include/exclude text.
Example: ^IMG_\d+ matches numbered image names.
{{ filter_regex_error }}
Allowed: g, i, m, s, u, y; i makes the regex case-insensitive.
MetricValueCopy
{{ r.label }} {{ r.value }}
MetricValueCopy
{{ r.label }} {{ r.value }}

        
Customize
Advanced
:

Introduction:

Text lists become more useful when order, spacing, separators, and duplicate handling are explicit. A copied file list, tag list, title list, or column of codes can look tidy at first and still sort poorly when it contains numbers, accents, blank rows, uneven whitespace, or repeated values.

Human-friendly ordering often differs from plain character ordering. In a character-by-character comparison, File10 can appear before File2. Natural sorting treats embedded digit runs as numbers, so filenames, issue labels, page names, and version-like text line up closer to how readers expect them to appear.

The sorter is best for one-item-per-line lists and simple token streams. TXT and CSV files are treated as plain text sources, so quoted CSV records, multi-column table logic, and escaped separators should be cleaned in a spreadsheet or data tool before sorting here.

How to Use This Tool:

  1. Paste text, drop a small TXT or CSV file, or browse for a plain text source.
  2. Choose the Input separator. Use new lines for ordinary lists, and choose comma, semicolon, space, or tab only when the source really is token-based.
  3. Pick a Sort mode: alphabetical, natural, character length, reverse, or shuffle.
  4. Set Case sensitive and Locale when the placement of uppercase, lowercase, accented, or language-specific characters matters.
  5. Use cleanup controls for blank lines, trimming, duplicate removal, leading list numbers, internal whitespace, leading articles, prefixes, suffixes, and line numbers.
  6. Add include, exclude, or regex filtering only after the basic split and cleanup settings match the source.
  7. Review Sorted Output, then copy or download the final text. Use the stats, character counts, and JSON views when counts or audit detail matter.

For a conservative first pass, choose new-line input, natural A-Z ordering, trim each line, ignore blank lines, and leave duplicate removal off until you can see which repeated items are intentional.

Interpreting Results:

Sorted Output is the final paste-ready text. It includes line numbers, prefixes, suffixes, and the selected output separator. The stats and JSON views describe processed items and settings, so they are useful for review but may not be byte-for-byte identical to the final decorated text.

  • Total items starts from the split source before later cleanup removes blanks or duplicates.
  • Unique is case-aware when case sensitivity is enabled and case-folded when it is disabled.
  • Character Counts measure the processed item list before numbering, prefixes, suffixes, and final joining.
  • Reverse flips the current processed sequence; it is not the same thing as alphabetical Z-A unless the source was already ordered A-Z.
  • Shuffle can be repeated only when the same input, settings, and seed are used.

If an invalid regex warning appears, the regex filter is skipped until the pattern is fixed. Other cleanup and sorting choices still run, so do not treat the output as regex-filtered while that warning is visible.

Technical Details:

Sorting is governed by collation: the comparison rule used to decide which string comes first. Alphabetical modes use locale-aware string comparison. Natural modes enable numeric comparison so digit runs are compared as values. A locale such as en-US, fr, or de can change accent and language-specific ordering; an unusable locale falls back to the browser default.

Transformation Core:

  1. Split the source text by the selected input separator.
  2. Optionally trim item edges, remove leading list numbers, collapse internal whitespace, and discard blank items.
  3. Apply plain include and exclude filters, then apply the regex filter when the pattern is valid.
  4. Order the cleaned items using the selected mode: alphabetical, natural, length, reverse, or shuffle.
  5. Remove duplicates when requested, using the active case-sensitivity rule.
  6. Add optional line numbers, prefixes, and suffixes, then join the result with the selected output separator and newline style.

Formula Core:

The reported average item length uses the processed item list before line numbering, prefixes, suffixes, and final joining:

average length = total characters in processed items processed item count

The displayed value is rounded to one decimal place. If the processed item count is zero, the average is reported as zero.

Sort mode behavior
Mode Comparison rule Use when
Alphabetical A-Z / Z-A Locale-aware text comparison without numeric collation. Words, labels, or titles without important embedded numbers.
Natural A-Z / Z-A Locale-aware comparison with embedded digit runs treated as numbers. Filenames, issue IDs, photo names, page names, and mixed text-number lists.
Character length Shortest item first, with alphabetical tie-breaking. Finding long labels, compacting prompts, or checking list verbosity.
Reverse Flips the processed sequence. The input order is meaningful and simply needs to run backward.
Shuffle Randomizes item order; a seed makes the same order repeatable. Review rotation, randomized prompts, or repeatable draft ordering.
Output views and their meaning
View Represents Best use
Sorted Output The final decorated text string. Copying or downloading the text you intend to paste elsewhere.
Text Stats Source item counts and processed item counts. Checking how much cleanup changed the list.
Character Counts Length and word metrics for processed items. Estimating size, density, and item length before decoration.
JSON Settings, counts, and the processed output item array. Auditing the run or moving the item array into another workflow.

Worked Examples:

Natural filename order:

Paste File10, File2, and File1 on separate lines, then choose Natural A-Z. The output becomes File1, File2, File10, which is the expected order for labels with embedded numbers.

Repeatable shuffled review list:

Paste four reviewer names, choose Shuffle, and enter draft-1 as the seed. The same input and seed recreate the same shuffled order, which is useful when a randomized list needs to be reviewed later.

Single-column CSV cleanup:

Paste alpha, beta, alpha, gamma, set input and output separators to comma, enable trimming, and then enable unique. The output keeps one copy of each item while preserving a comma-separated result.

FAQ:

How do I make File2 sort before File10?

Use a natural sort mode. It compares digit runs as numbers instead of treating each digit as plain text.

What should I put in the locale field?

Use a BCP 47 language tag such as en-US, fr, or de when you need language-specific ordering. Leave it blank for the browser default.

Why did my CSV rows break apart?

The sorter treats CSV as plain text. It does not preserve quoted fields, escaped commas, or multi-column records.

Why does JSON not exactly match Sorted Output?

JSON records the processed item array before final line numbering, prefixes, suffixes, and joining. Sorted Output is the final decorated string.

Are uploaded text files sent to a server?

No. Dropped or browsed files are read in the browser, processed locally, and exported from the current page.

Glossary:

Collation
The rule used to compare strings for ordering.
Natural sort
Ordering that treats embedded digit runs as numeric values.
BCP 47 language tag
A locale identifier such as en-US, fr, or de.
Seeded shuffle
A randomized order that can be reproduced from the same input, settings, and seed.
Decorated output
The final text after optional line numbers, prefixes, suffixes, and joining are applied.