PasteCleanly text tools

Remove extra spaces and blank lines

Remove the whitespace you don’t need while keeping intentional indentation.

Your pasted text stays in this tab. How privacy works

Clean gaps without flattening indentation

Original
Project     notes   

  Keep   this indentation.   
Result
Project notes
  Keep this indentation.

Enable Trim line endings, Collapse spaces between words, and Remove blank lines to get this result. The two spaces before Keep remain because the tool preserves indentation on nonempty lines.

Turn on only the changes you need

  • Trim line endings: remove trailing spaces, tabs, and nonbreaking spaces.
  • Collapse spaces between words: change gaps of spaces or tabs to a single regular space.
  • Remove blank lines: close gaps created by empty or whitespace-only rows.
  • Remove zero-width spaces and BOM: delete U+200B and U+FEFF when they are unwanted paste artifacts. This option leaves the joiners used in emoji sequences intact.

Protect alignment and paragraph breaks

Leave collapse and blank-line removal off for code, fixed-width columns, or text with deliberate spacing. Review invisible-character cleanup for scripts that intentionally use zero-width spaces. If your words are split across lines, use Fix line breaks instead.

Clean accidental whitespace without flattening the layout

Name the kind of whitespace that should change

An extra space at the end of a line is not the same problem as a tab between table cells, a blank paragraph or a zero-width mark in a copied identifier. Start by describing the expected change: “Remove trailing spaces but preserve the indentation,” or “Collapse repeated gaps in a paragraph without joining its lines.” Enable the smallest set of options that produces that result.

Paste a short sample with a line that needs cleanup and one that should remain unchanged. Include a line beginning with deliberate indentation if the original text uses it. Read the output next to the original rather than treating a visually tighter result as automatically better. The utility makes mechanical changes and cannot decide which whitespace is meaningful in a mixed document.

For a table or source code, the safer starting point is a plain-text copy with cleanup off. A tab can be a field separator, and indentation can be part of code structure. Work on a deliberately selected prose field if you need to clean a value inside structured text. Use the CSV and TSV converter to read or convert the table itself rather than changing its separators with a whitespace cleaner.

Test interior spaces, line endings and indentation separately

Copy the example below. The first line contains a wide gap; the last starts with two intentional spaces. A blank line separates them.

Project   notes
    

Keep this indentation.

Turn on Collapse spaces between words. The gaps inside the two nonempty lines should shrink, but the leading indentation on the last line stays. Then enable Remove blank lines if the gap between the entries has no meaning. Do not enable that option if the same blank line would separate paragraphs in a document. Try each setting independently before combining them.

Trailing whitespace is hard to see in a pasted example. Put an extra space at the end of a line yourself and compare the two versions with the text diff checker in character mode. This shows a practical distinction between a removed line-end space and a changed interior gap. It also makes it clear whether the destination silently trims the text after you paste it.

Try the spacing example in the editor

Decide whether blank lines carry paragraph or list structure

A blank row can be an accidental spacer introduced when copying from a document. It can also be the only marker between sections. Removing it from a paragraph can change how a Markdown renderer or a reading interface groups the text. For a one-item-per-line list, eliminating empty rows may be appropriate; for notes with headings and separate instructions, it may remove useful structure.

Check a blank line containing spaces as well as one with no characters. A whitespace-only row can look identical to an empty row but still affect an exact comparison. Use the option for blank lines if your goal is to remove both kinds of visual gap. If your goal is only to trim the spaces, keep paragraph breaks in place. Verify the number of meaningful records before and after if this text will become input to a list comparison.

When prose is wrapped across lines within a paragraph, removing blank lines will not rejoin the words. Use Remove line breaks to repair hard wraps, and keep the blank separators that identify paragraphs. For PDF text, compare the original reading order first so two columns do not get combined into one sentence.

Protect indentation, fixed-width text and tab-separated data

Indentation can show hierarchy in a checklist, place text under a column or determine how a program reads a block. The space-collapse option is intended to preserve leading indentation on nonempty lines. It can still change interior alignment, and that may matter in fixed-width files or text tables. If the data is meant for a machine rather than a reader, inspect the exact file format before collapsing anything.

A tab at the start of a line may be an indentation marker, while one in the middle may be a field separator. In TSV, replacing an interior tab with an ordinary space can merge two cells. Use the correct import setting for structured rows. If only one text column needs cleanup, extract that column or clean values in an application that retains the other fields. Do not flatten the full export just because the result is easier to read in a text box.

Test with a row that has the most demanding alignment, not only with simple prose. Compare the original and the result in a monospace view if column positions matter. In a receiving application that trims or expands tabs on paste, verify the stored result as well as the editor preview.

Inspect nonbreaking spaces and invisible marks before removing them

Text copied from a formatted source can contain nonbreaking spaces or marks that are not represented by a visible gap. A nonbreaking space can be intentional, for example to keep a number attached to a unit. A zero-width space can provide a useful line-breaking opportunity in some languages. A byte-order mark may appear after copying a file. Do not remove every nonstandard character simply because it is unfamiliar.

Use the character inspector on the shortest affected string. Compare the reported position with the words you expected. The dedicated whitespace option here removes the specified zero-width spaces and byte-order marks; it does not remove all joiners and directional marks. Test the expected result in the receiving system before applying the same rule to unrelated text.

If two visibly identical names differ because of a combining accent, removing spaces will not address that. Try Normalize Unicode for a deliberate equivalence rule. If the text instead looks garbled, the encoding guide can help identify the earlier conversion step. Preserve the unmodified source whenever language-specific marks or exact identifiers are involved.

Verify a result against the task, not just its appearance

Write down which cleanup switches were enabled. Look at the first and last line, an indented line and a line with intentionally repeated spacing. If the output will be pasted into a form, check a small sample there first: a form can change whitespace after you copy it. If the output is headed to another cleanup step, save the current result separately until you know which operation changed each character.

For a list of values that should be unique, decide whether whitespace differences should count before running Remove duplicate lines. When a tab or two spaces carries meaning, the values should remain distinct. When both represent the same copied name, a consistent cleanup can help them match. The matching rule should come from the intended use of the data rather than from how many duplicates disappear.

The PDF cleanup guide covers how to preserve reading order and paragraph breaks while removing paste artifacts. Keep a small before-and-after example with the rule, so someone else can repeat the operation without treating every kind of whitespace as disposable.

Leave meaningful whitespace untouched

A good result may retain more spaces than you expected. Alignment in a plain-text schedule, a gap inside a literal sample and an intentional paragraph break are all reasons to avoid a broad cleanup. If you cannot tell whether a mark has a purpose, keep it until you can compare the source and the destination. It is easier to remove one confirmed artifact later than to recreate the original structure after several cleanup options have changed it.

Check intentional gaps with a small before-and-after report

Take a line with an interior run of spaces, an indented line and a line ending in an extra tab. Run only the cleanup settings you need. Compare the result by character to see which exact gaps changed. This is particularly useful when the document is edited in a proportional font, where a tab and a few spaces can look similar.

If a colleague wants to repeat the process, send the unmodified sample along with the expected result and chosen settings. A phrase such as “clean up spacing” is too vague to distinguish preserving paragraph breaks from removing them. The example makes that difference explicit.