Text Length Sorter
cross-browser testing tools
World's simplest online line sorter for web developers and programmers. Just paste your text in the form below, press the Sort Lines button, and you get back the same lines but sorted by their length. Press a button – get the text. No ads, nonsense, or garbage.
Announcement: We just launched Online Fractal Tools – a collection of browser-based fractal generators. Check it out!
Want to sort lines alphabetically?
Use the alphabetic line sorter tool!
Using a String Length Sorter in Cross-browser Testing
A string length sorter can be useful if you're doing cross-browser testing. For example, if you want to neatify the way your web application displays a list of data, then you may want to sort the items so that they go from the shortest item to the longest (or from the longest to the shortest). To make sure your sorting algorithm works correctly, you may also want to write unit tests for it. A unit test is a simple program that takes an algorithm, input data, and output data, then runs the algorithm on the input data, and compares the result with the given output data. This way you can easily catch mistakes in the algorithm. In this program, the algorithm finds lengths of all given strings (one per line) and then sorts them by their length. Another use case for this program is finding the longest (or shortest) string or the longest (or shortest) text line. When you sort lines in ascending order, then the longest line will be the last one at the bottom (and the shortest line will be the first one on top), and if you sort lines in descending order, then the longest line will be the first one on top (and the shortest line will be the last one at the bottom).
Looking for more web developer tools? Try these!
Pro tip: You can use ?input=text query argument to pass text to tools.