# Remove Empty Lines

Delete all blank and whitespace-only lines to compact your text, or collapse runs of blank lines to one. Free and private — runs in your browser, nothing is uploaded.

## Run it

- **CLI:** `gizza tool remove-empty-lines "Paste text with blank lines to remove…"`
- **Web:** https://gizza.ai/tools/remove-empty-lines/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/remove-empty-lines/tool.json

## Inputs

- `text` — Text _(field)_
- `mode` — What to do with blank lines _(field)_
- `whitespace_only` — Also remove whitespace-only lines (spaces/tabs) _(field)_
- `trim_lines` — Trim leading/trailing whitespace on kept lines _(field)_

## Output

- Compacted text (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `text` — Text
- `mode` — What to do with blank lines
- `whitespace_only` — Also remove whitespace-only lines (spaces/tabs)
- `trim_lines` — Trim leading/trailing whitespace on kept lines

Example: `https://gizza.ai/tools/remove-empty-lines/?text=Paste%20text%20with%20blank%20lines%20to%20remove%E2%80%A6&mode=remove&whitespace_only=true&trim_lines=true`

---

## About this tool

**Remove Empty Lines** deletes the blank lines from a block of text so the
remaining lines sit together with no gaps. Paste your text, pick how blank lines
should be handled, and copy the compacted result.

- **What to do with blank lines**
  - *Remove all empty lines* — delete every blank line, leaving no gaps between
    content (the default).
  - *Collapse consecutive blanks to one* — reduce any run of two or more blank
    lines down to a single blank line, so paragraphs stay separated without
    large gaps.
- **Also remove whitespace-only lines** — treat a line that contains only spaces
  or tabs (or any other whitespace) as empty, not just a line that is literally
  empty. On by default.
- **Trim leading/trailing whitespace on kept lines** — also strip spaces and
  tabs from the start and end of the lines that remain. Off by default so
  indentation is preserved unless you ask for it.

Everything runs **locally in your browser** via WebAssembly — your text is never
uploaded.

### Worked example

Input:

```
First line

Second line
   
Third line

```

With *Remove all empty lines* and *Also remove whitespace-only lines* on (the
line with three spaces counts as empty), the output is:

```
First line
Second line
Third line
```

Switch the mode to *Collapse consecutive blanks to one* and the same input keeps
one blank line between each entry instead of removing them all.

### Handy for

- Cleaning up text pasted from a PDF or email that arrived double-spaced.
- Compacting a list where blank lines crept in between items.
- Tidying code or config after deletions left empty gaps behind.

### Limits & edge cases

- Line endings are normalized to `\n` (LF): Windows `\r\n` and old-Mac `\r`
  inputs come out with plain LF line breaks.
- A trailing newline at the very end counts as a final empty line and is removed,
  so the result never ends with a dangling blank line in *remove* mode.
- "Whitespace" follows Unicode rules, so non-breaking spaces (U+00A0) and the
  ideographic space (U+3000) also make a line count as empty when
  *whitespace-only* is on.
- This tool only removes blank lines. To collapse runs of spaces inside a line,
  or to strip every space, use a whitespace-cleaning tool instead.

### FAQ

<details>
<summary>What counts as an "empty" line?</summary>

By default, both a truly empty line and a line that contains only spaces or tabs
count as empty and are removed. If you turn off **Also remove whitespace-only
lines**, then only lines with zero characters are removed and a line of spaces is
kept as-is.

</details>

<details>
<summary>What is the difference between "remove all" and "collapse"?</summary>

**Remove all** deletes every blank line, so the remaining content is packed
together with no gaps. **Collapse** keeps a single blank line wherever there were
one or more in a row — useful when you want to keep paragraph breaks but get rid
of triple- and quadruple-spaced gaps.

</details>

<details>
<summary>Will it change the non-blank lines or their order?</summary>

No. The order of your content is preserved exactly. Non-blank lines are left
untouched unless you tick **Trim leading/trailing whitespace on kept lines**,
which strips spaces and tabs from the start and end of each remaining line.

</details>

<details>
<summary>Is my text uploaded anywhere?</summary>

No. The tool runs entirely in your browser as WebAssembly — the text you paste
never leaves your device.

</details>

## Related tools

- [Extract Action Items from Meeting Notes](https://gizza.ai/tools/action-item-extractor/): Extract action items, owners, and decisions from meeting notes or daily notes with deterministic rules. Markdown checklist or JSON, private in-browser.
- [Add Line Numbers](https://gizza.ai/tools/add-line-numbers/): Add line numbers to every line of text online, like nl or cat -n — custom start, step, separator, and alignment. Free and private, runs in your browser.
- [ANSI Log Renderer](https://gizza.ai/tools/ansi-log-renderer/): Paste ANSI-colored terminal output or CI logs and render them as HTML, or strip escape codes to plain text. Handles 16-color, 256-color, and truecolor SGR codes.
- [Censor Text](https://gizza.ai/tools/censor-text/): Redact a list of words (or common profanity) in any text by masking them — case-insensitive, whole-word or substring. Runs in your browser, nothing is uploaded, free.
- [Change Case](https://gizza.ai/tools/change-case/): Free online case converter — switch text between UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case and more, right in your browser.
