Text Sorter
Sort pasted text or TXT/CSV lists with natural order, seeded shuffle, cleanup filters, duplicate counts, and paste-ready local output.Text Sorter
| Metric | Value | Copy |
|---|---|---|
| {{ r.label }} | {{ r.value }} |
| Metric | Value | Copy |
|---|---|---|
| {{ r.label }} | {{ r.value }} |
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:
- Paste text, drop a small TXT or CSV file, or browse for a plain text source.
- 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.
- Pick a Sort mode: alphabetical, natural, character length, reverse, or shuffle.
- Set Case sensitive and Locale when the placement of uppercase, lowercase, accented, or language-specific characters matters.
- Use cleanup controls for blank lines, trimming, duplicate removal, leading list numbers, internal whitespace, leading articles, prefixes, suffixes, and line numbers.
- Add include, exclude, or regex filtering only after the basic split and cleanup settings match the source.
- 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:
- Split the source text by the selected input separator.
- Optionally trim item edges, remove leading list numbers, collapse internal whitespace, and discard blank items.
- Apply plain include and exclude filters, then apply the regex filter when the pattern is valid.
- Order the cleaned items using the selected mode: alphabetical, natural, length, reverse, or shuffle.
- Remove duplicates when requested, using the active case-sensitivity rule.
- 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:
The displayed value is rounded to one decimal place. If the processed item count is zero, the average is reported as zero.
| 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. |
| 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, orde. - 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.