press ⌘K to switch tools
TEXT
Code Cleaner
Remove blank lines, trailing whitespace, duplicate lines, and line numbers from code.
code-cleaner
§01 ABOUT THIS TOOL
Overview
Code copied from terminals, diffs, documentation, or log files often arrives polluted: line numbers in the gutter, trailing spaces, stray blank lines, repeated entries. This tool applies five independent line-based cleanups to any pasted text and shows the result instantly.
How to use
- Toggle the cleanups you want: Remove blank lines, Trim trailing spaces (both on by default), Remove duplicate lines, Strip line numbers, and Collapse spaces.
- Paste your text into Input.
- Copy the result from Cleaned — it updates live as you type or change options.
Examples
- With Strip line numbers:
42: const x = 1;→const x = 1; - With Remove duplicate lines: a log where
Connection resetappears 30 times keeps only the first occurrence - With Collapse spaces:
a = 1→a = 1
Notes
Transforms are purely line-based and language-agnostic — the tool does not parse syntax, so Collapse spaces will also collapse runs of spaces inside string literals and Remove duplicate lines treats identical closing braces as duplicates. Review the output before committing it.
FAQ
Is my code uploaded to a server?
No. All cleanup runs entirely in your browser with simple line-based transforms. Nothing is sent anywhere.
What does "Strip line numbers" remove exactly?
It removes a leading number followed by a colon, period, tab, or space at the start of each line — the format produced by grep -n, cat -n, editor gutters, and many code snippets copied from documentation.
In what order are the options applied?
Line numbers are stripped first, then trailing whitespace is trimmed, repeated spaces are collapsed, blank lines are removed, and duplicate lines are removed last — so a line that becomes empty after trimming is still caught by blank-line removal.