Nekonote Toolbox logo

Nekonote Toolbox

Free browser-based tools for developers and IT admins.

日本語

Terminal Paste Cleaner

Before you paste multi-line text into a terminal or an AI CLI such as Codex, unify the line endings and remove the trailing newline, tabs and control characters that a terminal can read as key presses. Copy the result in one click.

Start from a goal

Show line breaks, tabs and spaces as symbols

Shows exactly what will be copied. ␍ is CR, ␊ is LF, → is a tab and · is a space.


                    

How to use it

  1. Press the button that is closest to your goal. It sets all the options at once.
  2. Paste your text into the input box (or press “Paste from clipboard”). It is cleaned as soon as you paste.
  3. Under the input box you see which line endings it had and how many. A mix of CRLF and LF is shown as “mixed”.
  4. Press “Copy to clipboard” and paste into your terminal.

Details

Why does a paste sometimes run before it is finished?

Terminals can hand a paste to a program as one block (bracketed paste). When that works, line breaks inside the paste arrive as text. When it does not, each pasted line break looks exactly like pressing Enter.

The OpenAI Codex CLI issue tracker contains reports such as these (each one describes the reporter's own setup):

  • A multi-line paste submits the first line at once and leaves the rest in the input box (Windows Terminal with PowerShell, #31416, still open when checked).
  • On macOS with iTerm2, text is submitted at each line break when paste bracketing is off. Turning it on in iTerm2 fixed it for the reporters (#2006).
  • A pasted tab character acts as the “queue message” shortcut (Tab), so one paste splits into several queued messages (#44490, the maintainer said a fix was coming).
  • If the pasted text itself contains ESC[201~ (the end marker of a bracketed paste), the paste can end early and the rest is read as key presses (explainer).

None of these reports says the type of line ending (CRLF or LF) is the cause. Unifying line endings does not fix a terminal that fails to deliver a paste as one block.

What this tool can and cannot do

  • Joining into one line is the option that reliably helps. With no line break in the paste, nothing can be read as Enter. It is a workaround for long commands and long prompts.
  • Removing the trailing line break stops the last line from running by itself, so you decide when to press Enter.
  • Replacing tabs and removing control characters address the tab and ESC cases above.
  • Unifying line endings helps with text that mixes CRLF, LF and CR (from Notepad, email, spreadsheet cells). Left mixed, it can leave invisible CR characters at the end of lines in a Linux shell.
  • If you keep the line breaks, nothing here can guarantee that a paste will not run early; it depends on your terminal, OS and app version. If it keeps happening, join into one line, or save the text to a file and have the tool read the file.

What each option does

  • Line breaks are CRLF, CR, LF, U+0085, U+2028 and U+2029. A CRLF counts as one line break, never two.
  • A tab becomes the chosen number of spaces (it does not align to tab stops). Do not use it for code where tabs matter, such as a Makefile or Go.
  • Control-character removal covers ESC[200~ and ESC[201~, ANSI escape sequences such as colors, and control characters other than tab and line breaks (U+0000–U+001F, U+007F–U+009F).
  • Invisible-character removal covers U+200B, U+2060, U+FEFF (BOM) and U+00AD (soft hyphen). U+200D, which joins emoji, is kept so emoji do not break.
  • Curly quotes are a common reason that a command copied from a web page fails in a shell: “ is not a quote to the shell. Avoid this option for ordinary prose.

Copying and line endings

  • A browser text box (textarea) stores every line break as LF, so the original line endings cannot be seen after the text has been pasted in. This tool reads the text at the moment of pasting and counts the line endings from that.
  • Depending on your OS and browser, the clipboard text may already be LF when it arrives. The display then says “LF only”.
  • If you choose CRLF, use the “Copy to clipboard” button. Selecting the output box by hand and copying can change the line endings, depending on the browser and OS.
  • The symbol view shows the same text the button copies.

Privacy

Your text is processed in the browser and is not sent to a server. A command that contains a password or token stays on your device. The browser asks for permission only when you press “Paste from clipboard”.

FAQ

Q. Will this stop Codex from running my paste early?

A. Not for a paste that keeps its line breaks. The reported cause is a terminal that does not deliver the paste as one block, not the type of line ending. Joining into one line is the dependable workaround. Replacing tabs should help with the tab case.

Q. Should I use LF or CRLF?

A. LF is the norm for Linux and macOS terminals and scripts. Some Windows files, such as batch files (.bat), expect CRLF. Match the place you are pasting into.

Q. I want to convert a file, not pasted text.

A. Use the Line Ending Converter, which reads and downloads files. This tool is made for cleaning text before pasting.