The Claude Code copy-paste fix
If you copy a function out of Claude Code and paste it into your editor only to find broken indentation, line numbers, and stray bullets — this is the fix.
The five things Claude Code adds to your paste
- Line numbers from the Read tool —
1\t,2\tstuck to every line. - Tool-call bullets — ●, ⏺ at the start of certain lines.
- Box-drawing frames — ─, │, ┌, ┐ around tool results.
- Indent padding — 2 to 4 spaces on every line of code.
- Soft-wrap line breaks — sentences split at your terminal width.
The 30-second fix
- Copy from Claude Code as you normally would.
- Paste into the cleaner on removeclaudewhitespace.com.
- Click copy.
- Paste into your editor or wherever else.
Why a regex isn't enough
You can write a regex to strip ^\s*\d+\t. You can write another for ANSI. You can write a third to collapse blank lines. The trouble is the transforms interact: removing line numbers changes the leading indent, which changes how indent normalisation works, which changes whether a line gets joined to its neighbour. Doing it as one composable pipeline — with each step toggleable — is much more reliable than a one-shot regex.
The case for client-side
Code from Claude Code often contains environment variables, API tokens, internal hostnames, or proprietary logic. Sending it to a third-party server to clean whitespace is overkill at best and a security policy violation at worst. The cleaner runs in your browser via plain JavaScript — open DevTools and watch the Network tab to confirm.
Common scenarios
Pasting back into your editor
Defaults handle this case: line numbers stripped, indent normalised, tool bullets removed. Drop the result into VS Code or your editor of choice — it lands flush.
Pasting into a Reddit post
The Markdown / Reddit toggle is on by default. It left-trims every line and rejoins soft-wrapped paragraph lines, so your post doesn't come out as a mess of broken sentences and inset paragraph fragments.
Sharing in Slack or Discord
Same as Reddit — Markdown / Reddit mode handles the wrap and indent issues. For code blocks specifically, wrap the cleaned output in triple backticks before pasting.
Pasting into a bug report or PR description
Turn off Indent if you want to preserve the original code structure. Otherwise the defaults are good.
Related
- Why Claude Code output pastes messy — the technical breakdown.
- Strip ANSI escape codes online.
- Remove line numbers from code.
- Clean terminal output.