deftools.io Text & Data

Line Tools

Sort, deduplicate, number, and transform lists of lines. Sort A-Z, remove duplicates, convert to JSON/CSV arrays, and more — instantly in your browser.

About this tool

Line Tools is a Swiss-army knife for lists of text. Paste any set of lines — file names, URLs, IDs, tags, log entries — and apply one of the transformations: sort alphabetically or naturally, remove duplicates, trim whitespace, number or un-number lines, change case, reverse, shuffle, or pack the whole list into a CSV row, JSON array, or bullet list.

The Natural sort button sorts the way a human expects: file2.txt comes before file10.txt, not after — the pain point that plain A→Z gets wrong for anything with numbers. Use Output → input to chain operations, e.g. Trim spaces → Remove blanks → Natural sort → Remove duplicates, re-feeding the result each time.

Examples:

  • Input item10, item2, item1Natural sortitem1, item2, item10
  • Input banana / apple / banana / cherryRemove duplicatesbanana / apple / cherry
  • Input log_42, log_7, log_108Sort by numberlog_7, log_42, log_108
  • Input apple, apple, banana, appleFind duplicatesapple\t×3

FAQ

What is the difference between Sort A→Z and Natural sort?

Plain A→Z compares strings character by character, so "item10" sorts before "item2" because "1" < "2". Natural sort splits each line into alternating text and number chunks, so numeric chunks compare by their integer value — giving the order item1, item2, item10 that you would expect for file names, versions, or numbered items.

How do I run several operations in a row?

Click a transform button to produce the output, then click "Output → input" to move that result into the input box. Now the next operation you click runs on the already-transformed lines. You can chain as many steps as you need.

Does "Remove duplicates" keep the original order?

Yes. It scans top to bottom and keeps the first occurrence of each line (after trimming for comparison), dropping only later repeats. Original ordering and capitalisation of the kept lines are preserved.

What does → JSON array produce?

A single JSON array string with each non-empty line as a quoted element, pretty-printed with 2-space indentation. It is valid JSON ready to paste into a config file, API request body, or test fixture.

What does "Sort by number" do?

It finds the first number (integer or decimal, including negative) in each line and sorts the lines by that numeric value. Lines without any number sort to the end. This is handy for log file names, invoice numbers, or version tags embedded in text where alphabetical sort gets the order wrong.

How is "Find duplicates" different from "Remove duplicates"?

Remove duplicates keeps one copy of each line and discards the rest. Find duplicates does the opposite — it lists only the lines that appeared two or more times, each shown once with a count (e.g. "apple ×3"), so you can see exactly what is repeated and how often.

What does "Random sample" do?

It asks you how many lines to keep, then picks that many lines at random from the input (without replacement, so no line is picked twice). Use it to take a quick sample from a large list, e.g. picking 10 random user IDs out of 1,000 for a manual check.

What does "Add prefix / suffix" do?

Prompts you for text, then prepends (prefix) or appends (suffix) it to every line. Handy for wrapping each item in brackets, adding a common URL prefix, or appending a file extension like ".txt".

How does the share link work?

Click the "share" button above the output and your current input text is encoded into the URL. Anyone who opens that link sees the same list already loaded in the input box, ready to transform.

Related text & data tools

Copied!