Clean Text · browser-local

Remove Empty Lines

Strip out empty and whitespace-only lines from a list or block of text. GlyphSift normalizes line endings first, so mixed Windows and Unix breaks collapse consistently.

Works on up to 5,000 characters and 20,000 code points per field (at most 64 code points per character), processed in your browser.

36 graphemes36 code points36 bytes

Live result

Output

first line
second line
third line

Good fit

Use this tool when

  • A copied list has gaps between items.
  • You want a compact block without blank rows.
  • You are preparing lines for another tool or import.

Keep the original

Avoid it when

  • Blank lines separate meaningful paragraphs you want to keep.
  • You only need to trim leading and trailing spaces.
  • The spacing itself carries structure, such as poetry.
01

Reviewed truth vectors

Examples that expose the edge cases

Inputfirst line second line third line
Outputfirst line second line third line

Consecutive blank rows are all removed.

Inputa b
Outputa b

Whitespace-only lines count as empty.

Inputkeep keep
Outputkeep keep

Non-empty lines and their order are preserved.

02

Transparent implementation

How it works

  1. 01

    Normalize CRLF and CR to LF.

  2. 02

    Split into lines and drop any line that is empty after trimming.

  3. 03

    Join the remaining lines with single newlines.

03

Known limitations

What the result cannot promise

Whitespace-only lines are treated as empty and removed.

It does not merge lines or change their contents.

Trailing structure that relied on blank lines is lost.

04

Questions before copying

Frequently asked questions

Does it remove spaces inside a line?

No. It only removes lines that are empty or contain only whitespace. Use Remove Extra Spaces for within-line cleanup.

Are Windows line breaks handled?

Yes. CRLF and lone CR are normalized to LF before blank rows are removed.

Is the order changed?

No. Remaining lines keep their original order.

05

Testing and sources

How this tool is tested

GlyphSift Editorial — Text-engine notes written and reviewed by Hommer Zhao, Founder & General Manager

GlyphSift Editorial is the site's writing and review process, led by Hommer Zhao, who is accountable for every tool page and correction. Each tool's examples are written against real Unicode edge cases and checked against the engine before the page is published.

Each tool page is reviewed against the same six input classes the engine is tested with — ASCII, emoji, combining marks, non-Latin scripts, empty input, and 5,000-grapheme input — and cannot become eligible if it is only a parameter variation of another page.

Automated evidence

  • Tool-contract & coverage suiteShared suite · 37 cases across all tools it covers

    tests/tools-30.test.mjs mirrors the ToolRunner dispatch and asserts every registered engineId returns the contracted output shape, plus a coverage guard: every style keeps one output character per input character with unmapped characters passed through in place, and strikethrough, zalgo and upside-down never drop or split a grapheme cluster.

    Run in: node --test after a production build (vinext build)
  • Rendered-HTML suiteShared suite · 26 cases across all tools it covers

    tests/rendered-html.test.mjs renders the deployed server bundle and asserts the Unicode-version manifest and each wave's tool markup are present in the server-rendered HTML.

    Run in: node --test against the built dist/server bundle
  • Transform & cleanup suiteShared suite · 38 cases across all tools it covers

    tests/transform-cleanup.test.mjs exercises each deterministic cleanup and transform action against whitespace, duplicate, ordering, casing, and HTML-to-text edge cases.

    Run in: node --test, no network, no randomness

Standards this tool follows