REPL Prompt Stripper

Strip $, >>> and other REPL prompts from a pasted code block.

Open tool

Overview

Paste a pasted code block from a Python REPL, Node REPL, IPython, Bash shell, or PowerShell prompt, and the stripper removes the leading prompt characters (>>> , ... , $ , > , PS C:\> ) so you can run the code as a clean script. Multi-line continuations are detected and joined correctly.

It's for developers reading documentation, copying examples from Stack Overflow answers, or saving a console transcript as runnable code. Reach for it when a snippet from a tutorial includes the prompts and you don't want to delete them one line at a time.

How it works

The stripper recognises the standard prompts of each REPL: Python's >>> and continuation ... ; Node's > and ... ; IPython's In [N]: and ...:; Bash's $ and > ; Zsh's % ; PowerShell's PS [path]> . Prompts are detected at the start of each line; non-prompt lines (assumed to be output) are removed unless you opt to keep them.

Multi-line statements - a Python function definition, a multi-line Bash for-loop - are joined into single logical units so the output is directly executable.

Examples

  • Python REPL:
    >>> x = 1
    >>> def f():
    ...     return x
    >>> f()
    1
    
    x = 1
    def f():
        return x
    f()
    
  • Node REPL:
    > const x = 1
    undefined
    > x + 1
    2
    
    const x = 1
    x + 1
    
  • Bash transcript:
    $ ls
    a.txt b.txt
    $ cat a.txt
    hello
    
    ls
    cat a.txt
    
  • PowerShell:
    PS C:\> Get-Date
    Monday, May 18, 2026
    
    Get-Date
    

FAQ

What if my prompt is customised?

The stripper recognises standard prompts. For exotic prompts (oh-my-zsh themes, colour codes), strip ANSI escape sequences first, then run the prompt stripper.

Does it preserve output?

By default no - non-prompt lines are treated as output and removed. Toggle "preserve output as comments" to keep them.

Will it work for SQL prompts?

psql (db=#, db-#) and mysql (mysql>, ->) prompts follow the same pattern - the stripper recognises them too.

Can I run the cleaned code directly?

The output should be runnable as a script in the source REPL's language. Save it as a .py, .js, .sh, or .ps1 file and execute.

Try REPL Prompt Stripper

An unhandled error has occurred. Reload ×