Online Text Processor

Remove duplicates and extra spaces, change case, sort lines, quote and join lists, escape text and find and replace, with undo, in one browser tab.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Online Text Processor?

The Online Text Processor puts sixteen small text operations behind four tabs. Clean removes duplicate lines, extra spaces, empty lines and backslash escapes. Case converts to UPPERCASE, lowercase, Title Case or camelCase. Format joins lines with commas, splits on commas, wraps each line in quotes, adds escapes, sorts and reverses. Find does a literal find and replace across the whole text.

By default every operation rewrites the input box in place, so you can chain them: clean, then sort, then quote, then join. Undo and Redo step back through up to 50 edits. Untick In-place edit to send results to the Output box instead and keep your original untouched. A live counter under the input shows words, characters and lines.

Everything runs in your browser. Very large pastes (tens of megabytes) will make the page sluggish, because each click processes the whole text at once.

  • Sixteen operations across Clean, Case, Format and Find tabs
  • In-place chaining with 50 steps of undo and redo, or a separate Output box
  • Literal find and replace, with an optional case-insensitive mode
  • Live word, character and line counts
  • Runs in your browser; your text is not uploaded
Read the guide: Cleaning Up Text Lists: Spaces, Blank Lines, Duplicates and Commas

Updated

How to use the Online Text Processor

  1. Paste text into Input Text. Leave In-place edit ticked to chain operations, or untick it to write results to the Output box.
  2. Pick a tab: Clean for duplicates, spaces, empty lines and escapes; Case for UPPERCASE, lowercase, Title Case and camelCase; Format for joining, splitting, quoting, sorting and reversing.
  3. For quoted lists, choose Double or Single under Quote type, click Add Quotes to Lines, then Lines to Comma.
  4. To replace text, open the Find tab, fill in Find and Replace with, set Case sensitive, and click Find & Replace All.
  5. Use the undo and redo arrows above the input to step back, then copy the result with the copy button on the Output card.

Worked examples

Build a SQL IN list from a column of IDs

Input

red
green
blue

Output

'red', 'green', 'blue'

Choose Single under Quote type, click Add Quotes to Lines, then Lines to Comma. Wrap the result in IN ( ) and you have a valid SQL list. Remove empty lines first, or blank lines are skipped by Lines to Comma anyway.

Turn column headings into camelCase keys

Input

first name
last_name
EMAIL ADDRESS

Output

firstName
lastName
emailAddress

camelCase works line by line and treats spaces, underscores and hyphens as word breaks, so a pasted header row becomes one property name per line.

Background and insight

Most of these operations are one-liners in a Unix shell: sort, uniq, tr -s, paste -sd, and sed. The catch is that each has a gotcha. uniq only removes adjacent duplicates, so people pipe through sort first and lose their original order. tr -s squeezes characters but does not trim line ends. sed escaping rules differ between GNU and BSD. A browser tool trades scriptability for not having to remember any of that.

Two details here behave differently from a naive implementation. Sort Lines uses a case-insensitive alphabetical comparison, so "apple" and "Apple" sit together instead of every capitalised line sorting before every lower-case one, as plain code-point order would do. Find & Replace treats both the search and the replacement as literal text, so dots, brackets and dollar signs are not interpreted as regular expression syntax.

Order matters when you chain operations. Remove Extra Spaces before Remove Duplicate Lines, because "apple" and "apple " are different lines until the trailing space is gone. Remove empty lines before Add Quotes if you do not want blank entries in your list.

Common use cases

  • Preparing lists for code

    Quote and comma-join a column copied from a spreadsheet to paste into an array literal or a SQL IN clause.

  • Cleaning exported data

    Strip blank lines, doubled spaces and repeated rows from a log or CSV column before importing it elsewhere.

  • Fixing escaped strings

    Turn a JSON or log string full of \n and \" back into readable text, or escape text before pasting it into a string literal.

  • Bulk renaming

    Change a product name or variable across a document with a literal, case-insensitive find and replace.

  • Normalising headings

    Convert shouted ALL CAPS titles to Title Case or turn labels into camelCase identifiers.

Tips and limitations

  • Sort Lines is alphabetical, not numeric or "natural": item10 sorts before item2. Pad numbers with zeros if numeric order matters.
  • Title Case capitalises every word, including "of" and "the". Editorial styles such as AP and Chicago lower-case short words, so fix those by hand.
  • Newline to Comma replaces every line break, including blank lines, while Lines to Comma trims each line and skips blank ones. Pick the one that matches what you want to keep.
  • Comma to Newline splits on every comma, including commas inside quoted CSV fields. Use the CSV to JSON converter for real CSV.
  • Undo history only records the tool operations, not your typing between them, and it resets when you reload the page.

Sources and further reading

  1. uniq invocation, GNU Coreutils. Why uniq only removes adjacent duplicates
  2. tr invocation, GNU Coreutils. Squeezing repeated characters with tr -s
  3. paste invocation, GNU Coreutils. Joining lines with paste -sd
  4. sed: stream editor, The Open Group (POSIX). The portable sed syntax that GNU and BSD extend differently

Frequently asked questions

How do I chain several text operations in a row?

Leave In-place edit ticked and click the operations one after another. Each button rewrites the input box, so the next one works on the result of the previous one. If a step goes wrong, the undo arrow above the input returns the text to how it was before that click.

Why did Sort Lines put item10 before item2?

Sort Lines compares text alphabetically, character by character, so "1" in item10 comes before "2" in item2. It ignores case, so Apple and apple sit together. For numeric order, pad numbers with leading zeros (item02, item10) before sorting.

Does Find & Replace support regular expressions?

No, the Find field is matched literally. Characters like ., *, ( and $ are treated as plain text in both the search and the replacement, which is safer for everyday edits. For pattern-based replacements, build and test the expression in the Regex Tester first.

What does Remove Escape Characters do to my text?

It turns backslash sequences into the characters they stand for: \n becomes a line break, \t a tab, \" a quote and \\ a single backslash. Unknown sequences such as \q are left alone. Add Escape Characters does the reverse, so the two round-trip cleanly.

Can I keep my original text while trying operations?

Yes. Untick In-place edit and each operation writes its result to the Output box while the input stays as it was. Note that operations then always start from the input, so they do not chain; switch in-place editing back on when you want to build up several steps.

How are words and lines counted in the text processor?

Words are runs of non-whitespace characters, so "re-use" is one word and a standalone dash is also one. Characters include spaces and line breaks. Lines are counted by line breaks, so an empty box shows zero and a trailing newline adds one empty line to the count.

Is there an in-depth guide to the Online Text Processor?

Yes. “Cleaning Up Text Lists: Spaces, Blank Lines, Duplicates and Commas” covers the background, how it works, common pitfalls and worked examples. Read the full guide.