Remove Line Numbers
About this tool
About Remove Line Numbers
Code copied from a tutorial, a PDF, a forum or a terminal often brings its line numbers along, and they have to go before the code will run. Paste it here and the numbers at the start of each line are removed, whatever the format: 12. and 12) as in numbered lists, [12] and (12), 12: as in grep output, 12 | as in some code viewers, and a number followed by a tab, as many editors copy. After prefixes like 12. or 12 | only one space or tab is removed, so the indentation that follows is preserved and Python and YAML still work. Numbers followed only by spaces are trickier, because a line can legitimately start with a number ("2024 was a good year"), so they are removed only when at least four out of five lines start that way, which is what numbered code looks like. Lines without a number are left untouched, and the notice tells you how many lines were changed. Need the opposite? Switch Action to Add numbers. Nothing leaves your browser.
Built and maintained by Abhi JainUpdated
How to Remove Line Numbers
- 1
Paste the numbered text
Paste the code or text into the Text box. Click Sample to see an example.
- 2
Check the result
Remove numbers is selected. The notice shows how many lines had numbers removed.
- 3
Copy
Copy or Download the text without numbers.
Remove Line Numbers: questions and answers
Will indentation be kept?
For prefixes such as 12., 12), [12], 12:, 12 | or 12 and a tab, yes: only the number, its separator and one space or tab are removed, so the indentation that follows stays. When numbers are followed only by spaces, all of those spaces are removed, so check the indentation afterwards.
Why weren't my numbers removed?
Numbers followed only by spaces are removed when at least 80% of non-empty lines start that way. If fewer do, use Find and Replace with the regex ^\s*\d+\s+ and an empty replacement.
Can it remove numbers from a numbered list?
Yes: 1. and 1) prefixes are removed, which turns a numbered list into plain lines. To renumber instead, add numbers again with a new start.
How do I stop copying line numbers in the first place?
Many sites have a copy button that leaves numbers out; in PDFs and some viewers you can hold Alt (Option on Mac) while dragging to select a block that excludes the number column.
More Add Line Numbers presets
Related tools
- Text CleanerRemove duplicate and empty lines, extra spaces, line breaks, HTML tags, curly quotes and invisible characters in one pass.
- Find and ReplaceFind and replace text with several rules at once, plain or regex, match case, whole words and case-preserving replacement.
- Sort LinesSort lines alphabetically, naturally, by number or by length; reverse or shuffle them, and remove duplicates.
- Text to PDFConvert plain text or a .txt file into a paginated PDF with page size, margins, font, page numbers and line numbers.
- Page NumbersAdd customizable page numbers to top or bottom margins.