Text Sorter

Sắp xếp dòng theo A-Z, Z-A, theo độ dài, hoặc ngẫu nhiên.

Cách sử dụng Text Sorter

1

I'm ready to translate to Vietnamese following your rules. However, I notice you wrote "Enter Text" as a placeholder. Please provide the actual text you'd like me to translate, and I'll deliver the Vietnamese translation while keeping "ToolHQ" and technical terms in English.

Nhập văn bản bạn muốn sắp xếp, mỗi dòng được phân tách bằng ký tự xuống dòng.

2

Chọn tùy chọn sắp xếp

Chọn tùy chọn sắp xếp bạn muốn sử dụng: A-Z, Z-A, by length, hoặc random.

3

Sắp xếp Văn bản

Nhấp vào nút sort để lấy văn bản đã được sắp xếp, sẽ được hiển thị trong output box.

Công cụ liên quan

Sort text lines online: alphabetical, numeric, length, random

Sort text lines online: alphabetical, numeric, length, random

Sort any list of text lines alphabetically, numerically, by length, or randomly with ToolHQ's text sorter, paste your list, choose your sort mode, and get an ordered result in one click with optional duplicate removal.

A text line sorter is a tool that takes a multi-line block of text and rearranges the lines according to a sorting rule, alphabetical order (A-Z or Z-A), numerical value, line character count, or random shuffle, and returns the reordered list.

Sorting a list by hand is feasible for ten lines; it becomes impractical at a hundred. When you need a keyword list in alphabetical order for a client presentation, a product list sorted by name for a catalogue, or a data export sorted numerically for analysis, a text sorter does the job in under a second regardless of list length.

Key takeaways

  • ToolHQ supports A-Z, Z-A, numeric, by line length, and random sort modes
  • Optional duplicate removal can be combined with any sort in one pass
  • Case-insensitive mode groups uppercase and lowercase versions of the same word together
  • Processed in your browser, no data is sent anywhere
  • Blank lines can be removed during sorting for cleaner output

Sort modes explained

Alphabetical (A-Z and Z-A)

Lines are sorted by their first character, then the second, and so on, following the standard dictionary order used in indexes, catalogues, and glossaries. In case-insensitive mode, "Apple," "apple," and "APPLE" sort together; in case-sensitive (ASCII) mode, uppercase letters sort before lowercase.

Example:

  • Input: "banana, apple, cherry, date"
  • A-Z output: "apple, banana, cherry, date"
  • Z-A output: "date, cherry, banana, apple"

Alphabetical sorting is the most common mode: keyword lists, name lists, product catalogues, glossary entries, and any human-readable list benefit from A-Z ordering.

Numerical sort

Lines containing numbers are sorted by their numeric value rather than their textual representation. This matters because alphabetical ordering puts "2" before "10" (because "1" comes before "2" in character order), while numerical ordering correctly places "10" after "9."

Example:

  • Alphabetical: 1, 10, 2, 20, 3
  • Numerical: 1, 2, 3, 10, 20

Numerical sort is essential for lists of scores, prices, quantities, page numbers, or any data where numeric magnitude matters.

Sort by line length

Lines are sorted from shortest to longest, or longest to shortest, based on the character count of each line. Blank lines (zero characters) sort to the top in shortest-first mode.

Example:

  • Input: "hippopotamus, cat, elephant, dog"
  • Shortest first: "cat, dog, elephant, hippopotamus"

Length sorting is useful for readability analysis (identifying consistently long lines), for laying out text where shorter items should appear first, and for spotting unusually long outlier entries in a list.

Random sort (shuffle)

Lines are rearranged in a random order using a random number generator. Each shuffle produces a different order. Useful for randomising a list before assigning items (random team assignments, random prize draws from a text list, randomised quiz question order).

According to Wikipedia's article on sorting algorithms, sorting is one of the most extensively studied problems in computer science, with dozens of algorithms developed to handle different data sizes, stability requirements, and performance characteristics. Most browser-based text sorters use JavaScript's built-in array sort, which typically uses a hybrid of insertion sort and quicksort.


When you need to sort text lines

Keyword research organisation. A merged keyword list from multiple research tools is typically unsorted. Sorting alphabetically makes it scannable, helps you spot clusters of related terms, and makes deduplication more obvious (duplicate entries appear adjacent to each other).

Contact and name lists. A list of names sorted A-Z is the standard format for directories, sign-in sheets, and participant lists. Sorting before distributing saves every reader from having to scan randomly.

Data preparation for analysis. Before importing a list into a spreadsheet or database, sorted order makes it easier to verify completeness, spot patterns, and identify outliers.

Programming and configuration. Import lists, dependency declarations, CSS class lists, and JSON array contents are easier to review and maintain in alphabetical order. Sorting before committing to version control reduces merge conflicts.

Meeting and presentation materials. Agenda items, bullet point lists, and feature lists sorted alphabetically or by priority create a more professional and scannable output.


Mini-story: A recruiter compiled a list of 400 candidate names from three separate recruiting platforms into a single text file. The list was in no particular order and contained duplicates from candidates who had applied through multiple channels. She ran the list through a text sorter set to A-Z with duplicate removal enabled, got 312 unique names in alphabetical order, and formatted it into a clean candidate tracker in under five minutes.

Try ToolHQ's text sorter


How to use the text sorter

  1. Paste your list into the input box. Each item should be on its own line.
  2. Choose a sort mode. A-Z, Z-A, numerical, by line length, or random.
  3. Set options. Toggle case-insensitive mode, enable duplicate removal, and choose whether to remove blank lines.
  4. Click "Sort." The sorted list appears in the output box immediately.
  5. Copy the result. Use the copy button to transfer the sorted list to your clipboard.

Sorting with duplicate removal

Combining sort and deduplicate in one pass is a common pattern. Sorting first groups identical lines adjacent to each other, making deduplication straightforward, the tool keeps the first occurrence and removes subsequent ones.

Workflow How to do it
Sort A-Z + remove duplicates Enable both options, run once
Find duplicates before removing Sort first to see which lines are adjacent, then remove
Random order without duplicates Enable duplicate removal + random sort
Prepare for visual review Sort A-Z to make adjacent duplicates visible for manual review

According to Wikipedia's article on alphabetical order, alphabetical ordering has been used to organise written lists since at least the first century BC and remains the dominant convention for indexes, directories, and glossaries across most written languages.


Mini-story: A content strategist was building a topic cluster strategy and had brainstormed 150 article ideas in a freeform document. The ideas were scattered across the document with no structure. She extracted them one per line, ran them through the text sorter in A-Z mode with duplicate removal, and immediately saw natural clusters forming, all the "how to" variants grouped together, all the "best" variants grouped together. The sorted list became the outline for her cluster strategy in minutes.


Frequently asked questions

Does alphabetical sort treat uppercase and lowercase as the same? In case-insensitive mode, yes. In case-sensitive mode, uppercase letters sort before their lowercase equivalents (ASCII order: A=65, a=97). Toggle case-insensitive mode to group mixed-case variants together.

How does numerical sort handle text lines that mix numbers and words? Lines without leading numbers sort after numeric lines in ascending numerical sort. For mixed lists, numerical sort works best when each line either starts with a number or is entirely numeric.

Can I sort more than one column? The tool sorts lines as single strings. For multi-column data, sort by the first column by default. For sorting by another column, you would need to restructure the data so the sort key is at the start of each line.

Does random sort produce a truly random order? The tool uses a pseudo-random number generator (PRNG), which produces a random-looking but computationally generated sequence. For most practical purposes, list shuffles, random assignments, this is sufficiently random. It is not cryptographically random.

Is my list stored or sent anywhere? No. Processed in your browser, no data is sent anywhere. Your list is processed locally on your device.


The short version

Text sorter modes: A-Z for human-readable lists, Z-A for reverse lookup, numerical to fix "10 before 2" alphabetical issues, by length to find short or long outliers, and random for shuffles. Combine with duplicate removal to clean a list and sort it in one pass.

Sort your list now at ToolHQ, four sort modes, duplicate removal, browser-based, no account needed.

For related tools, try remove duplicate lines for standalone deduplication, or add line numbers to number your sorted list automatically.