Home › Text Tools › Remove Empty Lines

Remove Empty Lines

Paste text with gaps and get it back without the blank lines. Remove every empty line, keep a single blank line between paragraphs, or only clean up the start and end, and see exactly how many lines were removed.

Last updated:

What to do with blank lines
Enter your values to see the result.
Advertisement
Advertisement

How to use the Remove Empty Lines

  1. Paste your text into the box.
  2. Choose a mode: remove all blank lines, collapse runs into one, or only trim the start and end.
  3. Set options for whitespace-only lines and trimming.
  4. Check the counts and removed line numbers.
  5. Click Copy results to copy the cleaned text.

The three modes compared

Example input (· marks a line containing only spaces):

InputRemove allCollapse into oneTrim start/end only
(blank)
Apples
(blank)
·
(blank)
Bread
(blank)
Apples
Bread
Apples
(blank)
Bread
Apples
(blank)
·
(blank)
Bread

Where blank lines come from

  • Copying from PDFs and web pages, which often add a blank line after every paragraph or even every line.
  • Mixed line endings: a file with Windows CRLF line endings opened as if it used old Mac CR endings can look double-spaced.
  • Exports and logs that pad records with empty lines.
  • Whitespace-only lines left in code by editors, which look empty but are not, and are flagged by linters.

Frequently asked questions

What counts as an empty line?

A line with no characters at all. With the whitespace option on (the default), lines that contain only spaces, tabs or other invisible whitespace also count as empty, which is usually what you want for text copied from web pages or PDFs.

How do I keep paragraphs separated?

Choose “Collapse runs into one blank line”. Groups of several blank lines become exactly one, so paragraphs stay separated while the extra gaps disappear.

What is the difference between removing empty lines and removing line breaks?

Removing empty lines deletes only the blank lines and keeps every line of text on its own row. Removing line breaks joins all the lines into one paragraph. Use the Remove Line Breaks tool for that.

Will it change the indentation of my code?

No, unless you tick “Trim spaces”. By default only empty lines are removed and all other lines keep their leading spaces or tabs.

Does it keep Windows line endings?

Yes. If your text uses CRLF line endings, the result uses CRLF too; otherwise it uses LF.

Is there a size limit?

No fixed limit. Everything runs in your browser, and texts with hundreds of thousands of lines are processed in well under a second on a typical computer.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Remove Line BreaksStrip line breaks and extra spaces, keep paragraphs if you want.Remove Extra SpacesClean up double spaces, tabs, blank lines, non-breaking and invisible spaces in one click.Remove Duplicate LinesDelete duplicate lines from any list, ignoring case or spaces, keep first or last, and sort.Sort Lines AlphabeticallySort a list A-Z, Z-A, numerically, naturally or by length, or shuffle it.JSONL to CSV ConverterConvert JSON Lines / NDJSON to CSV with flattened columns; streams large files locally.JSONL to JSON ConverterConvert JSON Lines / NDJSON to a JSON array and back, with line-level error reports.Online Word ProcessorFree browser word processor with headings, lists, tables and images. Autosaves; export DOCX or PDF.Case ConverterConvert text to UPPERCASE, lowercase, Title Case, camelCase and more.MLA Format GeneratorBuild an MLA 9 heading, title page layout and Works Cited entries.Lorem Ipsum GeneratorGenerate placeholder text as paragraphs, words or lists, with HTML.Text RepeaterRepeat any text or emoji up to 100,000 times with custom separators.Find and Replace TextFind and replace words or regex patterns in any text, with match highlighting and undo.Add Line NumbersNumber every line of your text with custom start, step, padding and separator, or remove numbers.Add Prefix and Suffix to LinesAdd text to the start and end of every line: quotes, commas, bullets or SQL lists.Comma SeparatorTurn a column of lines into a comma separated list and back, with any delimiter.Text to Handwriting ConverterTurn typed text into realistic handwriting on notebook paper and save it as PNG or PDF.Japanese Kana ConverterConvert romaji to hiragana or katakana, kana to romaji, and hiragana to katakana instantly.Pinyin Tone ConverterTurn pinyin tone numbers (ni3 hao3) into tone marks (nǐ hǎo), or tone marks back into numbers.Random Word GeneratorGenerate random English words by type, length, first letter and syllables, then copy them.List RandomizerShuffle a list into random order, pick random items or split it into fair teams.Email ExtractorPull every unique email address out of text or files, sort, filter by domain and export CSV.URL ExtractorExtract every link from text or HTML, remove duplicates, filter by domain or protocol.Strip HTML TagsRemove HTML tags and get clean plain text with line breaks and decoded entities.Online NotepadPrivate notepad that autosaves notes in your browser, with find, word count and .txt download.Remove PunctuationStrip all or only selected punctuation from text, with smart options for apostrophes and numbers.Text SplitterSplit long text into chunks by characters, words, lines or a delimiter, with numbering and copy.Remove AccentsStrip accents and diacritics from text (é→e, ñ→n, ß→ss, ø→o) instantly, live as you type.Sort NumbersPull numbers out of any text and sort them ascending or descending, with sum, average and median.Thread SplitterSplit long text into numbered X, Threads, Bluesky or Mastodon posts at sentence boundaries.Duplicate Word FinderFind repeated words in your text: doubled words like "the the" and overused words, highlighted.Alternating Caps GeneratorTurn text into aLtErNaTiNg caps, random caps or alternating words, then copy it.Random Paragraph GeneratorGenerate readable random English paragraphs by topic and length for writing and design.Random Sentence GeneratorGenerate random grammatical sentences: simple, compound, complex and questions.Markdown to Plain TextStrip Markdown syntax and keep clean plain text with lists, line breaks and link URLs.SRT to TextTurn SRT or VTT subtitles into a clean transcript with paragraphs, with or without timestamps.Transcript CleanerRemove timestamps, speaker labels and filler words like um and uh, and fix broken line breaks.Extract Numbers from TextPull every number out of text: decimals, negatives and percentages, with sum, average and CSV.Extract Phone NumbersFind phone numbers in any text, normalize them to E.164, remove duplicates and export CSV.Sort Lines by LengthSort lines from shortest to longest or the reverse, with ties sorted A-Z and lengths shown.Sort Words AlphabeticallyPut the words in any text in A-Z or Z-A order, remove duplicates and pick a separator.Sentence SplitterSplit text into one sentence per line, smart about abbreviations, decimals and quotes.Text to Table ConverterTurn tab, comma, pipe or space separated text into a table to copy as rich text, Markdown or plain text.Text TruncatorShorten text to a character, word or sentence limit without cutting words, with an ellipsis.Bulk Find and ReplaceApply a whole list of find → replace pairs to your text at once, with a per-pair change log.Contraction ConverterExpand contractions (don't → do not) for formal writing or contract phrases for a casual tone.Count Duplicate LinesCount how many times each line appears, sorted by frequency, with duplicates-only and CSV export.Double Space TextAdd blank lines between lines or paragraphs (1.5, double, triple spacing) or remove them again.Em Dash ReplacerReplace em and en dashes with commas, hyphens or periods and normalize ellipses and fancy punctuation.Extract Domains from URLsPull hostnames or root domains out of URL lists, strip www, dedupe and count links per domain.List to Sentence ConverterTurn a list into a natural sentence with commas and “and” or “or”, with an Oxford comma toggle.Merge Lines Side by SideCombine two to four lists line by line with any separator, padding or filling uneven lengths.Remove Line NumbersStrip leading numbers like 1., 1), [1] or code line numbers from every line and keep the text.Remove Stop WordsStrip common stop words (the, and, of…) from text in 7 languages to reveal the keywords.Remove Text in BracketsDelete everything inside ( ), [ ], { }, < > or custom markers, with nested bracket support.Remove URLs from TextStrip links, www addresses and bare domains from text, plus emails, @mentions or hashtags.Trim Characters from LinesRemove the first or last N characters, or text before/after a marker, on every line.Paragraph to Bullet Points ConverterSplit paragraphs into bullet points by sentence or clause, with your choice of bullet style.Compare Two ListsFind items only in list A, only in list B, in both lists, or in either, with copy and sort.DOCX to Text ConverterExtract plain text from Word .docx files, in batch, with list markers, tables and .txt download.English to IPA ConverterConvert English text to IPA phonetic transcription in US or UK accent, with stress marks.Hidden Character DetectorFind and remove zero-width spaces, non-breaking spaces and other invisible Unicode characters.Letter to Number ConverterConvert letters to alphabet numbers (A=1 to Z=26) and back, with ASCII codes and letter sums.Markdown to Word ConverterConvert Markdown to a styled Word .docx file with headings, lists, tables, code and links.Plural GeneratorConvert English nouns from singular to plural and back, irregulars included, one word per line.Remove Text FormattingPaste rich text from Word, Google Docs or the web and get clean plain text instantly.Smart Quotes ConverterConvert curly quotes, dashes and ellipses to straight ASCII, or straight quotes to typographic ones.Text to HTML ConverterTurn plain text into clean HTML: paragraphs, line breaks, links, lists and escaped entities.Text to Word ConverterTurn text or a .txt file into a Word .docx with your font, margins and page size.
See all 96 Text Cleaning & Formatting →