Text Line SorterFree online other calculator — instant results, no sign-up

Sort lines by Unicode code point order.

Inputs

Sorted lines
Hello world. This is a sample.

Sign in to save results and favorites.

About the Text Line Sorter

The Text Line Sorter arranges lines of text in ascending Unicode code point order. It compares characters from left to right rather than using language-specific alphabetical rules. With the default text, “Hello world. This is a sample.”, the output remains unchanged because the input contains only one line.

Text
The text to sort, with each line treated as a separate text entry; it has no physical units.

Formula and method

L = splitLines(T); S = sort(L, ≺), where a ≺ b if cp(a[k]) < cp(b[k]) at the first differing character position k, or if a is a proper prefix of b. For T = "Hello world. This is a sample.", S = ["Hello world. This is a sample."].
  • TThe complete input text.
  • LThe sequence of lines obtained by splitting the input at line breaks.
  • SThe sequence of lines sorted in ascending Unicode code point order.
  • a, bTwo lines being compared.
  • kThe first character position where the two lines differ, counting Unicode code points.
  • cpThe function that returns a character's Unicode code point value.
  • ≺The ordering relation meaning that one line comes before another.

Separate the input into lines and compare each pair lexicographically by Unicode code point. The first differing character determines their order; if one line is an exact prefix of another, the shorter line comes first. Sorting changes line positions, not the order of characters within a line. The default input contains a single line, so the worked result is: Sorted lines = Hello world. This is a sample.

Worked example

These are the calculator's starting values and the results it actually produces for them.

Inputs

  • TextHello world. This is a sample.

Results

  • Sorted linesHello world. This is a sample.

How to use the Text Line Sorter

  1. 1Enter or paste your content into Text, placing each entry on its own line.
  2. 2Review capitalization, spaces, and punctuation because these characters affect Unicode ordering.
  3. 3Run the sorter to arrange the lines in ascending Unicode code point order.
  4. 4Read the Sorted lines output from top to bottom and copy it as needed.
  5. 5For the default input, confirm that Sorted lines = Hello world. This is a sample.

Reading your result

Each output row represents an input line in its sorted position, not a numeric result or a separately sorted sentence. Earlier rows precede later rows under the Unicode comparison rule. The default example produces one row containing exactly “Hello world. This is a sample.”

Limitations

Unicode code point order is not locale-aware dictionary order or natural numeric order. Capitalization, leading spaces, punctuation, and invisible characters can affect placement. Visually identical text may sort differently when encoded with different Unicode sequences. Blank-line handling, line-ending recognition, and Unicode normalization are not specified here; check the output if those details matter.

Common questions

Why does the default text stay unchanged?+

“Hello world. This is a sample.” contains no line break, so it is a single sortable entry. The sorter does not rearrange its words or sentences.

Does this sorter ignore uppercase and lowercase differences?+

No. Uppercase and lowercase characters have different Unicode code points. Basic Latin uppercase letters precede basic Latin lowercase letters in code point order.

Are lines containing numbers sorted by numeric value?+

No. Digits are compared as characters from left to right, so numeric-looking lines are not necessarily placed in numerical order.

Will sorting remove duplicate lines?+

Sorting alone does not remove duplicates. Identical lines compare equally and remain repeated entries unless a separate deduplication operation is applied.

Does the calculator save my information?+

Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.

You might also like

Results are estimates for informational purposes and are not financial, medical or legal advice.