Text
Line Operations
Tidy a pasted block in one click: sort it, reverse it, number it, trim it, or join wrapped lines back into paragraphs you can copy or download.
Result
—
Output actions
Ready to copy output once your result appears.
Each button starts from the input box
Line Operations applies one pass to Input lines and writes Result. Sort A → Z, Sort Z → A, Reverse order, Remove duplicates, Remove blank lines, Number lines, and Trim whitespace each read the box you pasted, not the previous Result. Remove line breaks is separate: with Preserve paragraphs when removing line breaks checked, a blank line stays as a paragraph gap and the breaks inside a paragraph become spaces. Copy output and Download output both use the latest Result. The download file is line-operations.txt.
How to change the lines
- 1Paste into Input lines, or press Load sample, which fills A wrapped, a break, paragraph., a blank line, Another, a break, and paragraph. Load sample does not run a pass by itself.
- 2Press one operation. Preserve paragraphs when removing line breaks is checked on arrival and affects only Remove line breaks. The other seven buttons ignore that checkbox.
- 3Read Result. To run a second pass, paste Result back into Input lines and press the next button. Reset clears both boxes. A pass does not append to the previous Result.
What it is good for
- • Joining a wrapped paragraph from a PDF paste while keeping the blank line before the next paragraph.
- • Numbering a short list as 1. and 2. without sorting it first.
- • Reversing or sorting the rows you pasted, knowing the previous Result is not the input.
Example
Input
A wrapped paragraph. Another paragraph.
Output
A wrapped paragraph. Another paragraph.
Load sample, leave Preserve paragraphs when removing line breaks checked, then press Remove line breaks. Unchecking the box joins everything into one line and turns the blank line into two spaces.
What each button reads
Every pass splits Input lines on \n or \r\n and writes a new Result. Sort A → Z and Sort Z → A use localeCompare with the browser's default locale. That is not a byte-order sort and it is not a natural-number sort. Digits are characters, so item10 comes before item2 because 1 is before 2. Letter case follows that same locale comparison: a and A sit next to each other, and which one is first depends on the locale rather than on a fixed uppercase-first rule. Reverse order flips the row order and does not sort.
Remove duplicates keeps the first exact row and drops later rows that are the same string. It does not trim and it does not ignore case, so Apple and apple both stay, and a row with a leading space does not match the trimmed word. Remove blank lines drops rows whose trim is empty, including a row of spaces. Number lines prefixes 1. , 2. , and so on, and a blank row still receives a number. Trim whitespace trims each row and keeps the row even when the trim is empty. None of these seven buttons call the others.
The eight controls
The seven outline buttons and Remove line breaks are the whole set. There is no menu for a combined pass, no ignore-case checkbox, and no natural-number checkbox. Preserve paragraphs when removing line breaks starts checked. Remove line breaks first turns \r\n into \n. With the box checked, it splits on a break, optional spaces or tabs, and at least one more break, replaces the remaining breaks inside each piece with a single space, and joins the pieces with a blank line. The sample becomes A wrapped paragraph. then a blank line then Another paragraph.
With the box unchecked, every break becomes a space, so the blank line in the sample becomes two spaces in a single line: A wrapped paragraph. Another paragraph. Load sample only fills the input. Reset clears the input and Result. Copy output and Download output read Result. If you press Sort A → Z and then Remove duplicates, the second press sorts nothing: it deduplicates the original box. Paste the sorted Result back when the second pass should see the first.
When a single pass is the right pass
Use Remove line breaks when a PDF or a web page wrapped a paragraph and a blank line still marks the next paragraph. Use Number lines when a checklist should gain 1. and 2. in the order you pasted. Use Reverse order when the newest log row should become the last, or the first, without an alphabetical pass. Use Sort A → Z or Sort Z → A when the destination wants locale order and you can accept item10 before item2.
A duplicate pass that should trim, ignore case, and keep the first spelling is the text deduplicator. An alphabetical pass that can place item2 before item10 is the text sorter. The pasted-list guide walks through that choice, including when the original order still matters. This page will not shuffle. A random order is a different tool, and it is not one of these buttons.
Joins, blanks, and digit order
Remove line breaks does not delete a hyphen. wrap- followed by a break and ped word becomes wrap- ped word, with a space where the break was. The hyphen stays because stripping it would also change a real hyphenated word. Column order from a PDF is not repaired. If the paste reads down the first column and then the second, the join follows that order. A heading that was its own wrapped line becomes part of the paragraph unless a blank line separated it.
Number lines numbers every row the split produced, including blanks, so a, a blank, and b become 1. a, then 2. with nothing after the space, then 3. b. Remove blank lines would have dropped the middle row first, but only if you paste that result back and press Remove blank lines as its own pass. Trim whitespace on a row of spaces leaves an empty row in Result. Remove duplicates on two identical blank rows keeps one of them, because the match is exact and the first empty string is a row.
Rules and limitations
Seven line buttons each split Input lines and replace Result. Sort uses localeCompare. Dedupe is case-sensitive and does not trim. Blank removal trims. Numbering uses 1. and keeps blank rows. Trim keeps a row that becomes empty.
Remove line breaks honors Preserve paragraphs when removing line breaks, which starts checked. A second button does not see Result until you paste it back. Copy and download read Result. Reset clears both boxes. Hyphens are kept.
Common problems
If the second press ignored the first Result, that is the design. Paste Result into Input lines before the next button.
If item10 sorted ahead of item2, the sort is not numeric. If a wrapped word gained a space after a hyphen, the join replaced the break and left the hyphen. If a PDF column mixed into the sentence, the join followed the paste order.
Frequently asked questions
Does the next button see the last Result?
No. Each button reads Input lines. Paste Result back into the input when you want a second pass.
Why does item10 sort before item2?
Sort A → Z uses localeCompare on the whole row. The character 1 is before 2, so item10 comes first. There is no natural-number option.
Will Remove line breaks delete a hyphen?
No. A break after a hyphen becomes a space, and the hyphen stays. wrap- plus a break plus ped becomes wrap- ped.
Do blank rows get numbers?
Yes. Number lines prefixes every row, including a row that is empty. Remove blank lines is a separate press, and it does not run first.
Is my input uploaded or saved?
This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.
About this tool
Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.
Guides
- Clean a pasted list while preserving its order
Remove duplicate lines, choose matching rules and join wrapped text without accidentally sorting your list.
Next steps
Related tools
Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.
Remove Duplicate Lines
Remove duplicate lines while keeping the first copy in its original order.
Open Remove Duplicate LinesText Sorter
Sort lines of text alphabetically or in reverse.
Open Text SorterFind & Replace
Replace every plain-text or regular-expression match, optionally ignoring case.
Open Find & ReplaceHTML to Plain Text
Extract plain text from HTML, with paragraph breaks and link handling.
Open HTML to Plain TextTrust
Policies, contact, and answers
Clear pages for how Toolbench works, what we collect, and how to reach us.