# Remove duplicate lines

> Remove repeated lines with optional case matching.

[Open tool](https://www.toolcabana.com/mg/deduplicate-lines) · [Text and writing](https://www.toolcabana.com/mg/category/text-and-writing)

Tool ID: deduplicate-lines. Requested language: mg. Description language: en. Complete guide translation: no; untranslated sections use English.

## Overview (en)

Remove Duplicate Lines deletes repeated lines from a list and keeps the first copy of each in its original order. Matching is case-sensitive by default; you can switch that off, trim spaces from line edges before comparing, drop empty lines, or keep the last occurrence of each line instead of the first.

## Supported tasks (en)

Remove repeated lines with optional case matching.

## Steps (en)

1. Type or paste your source, or load an example.
2. Change the basic settings or open Advanced mode to fine-tune the result.
3. Review and copy or download your result. Pause Live results to run manually. Sources or individual settings above 20,000 characters require an explicit run.

## Settings

- Trim line edges (en; key: trim; type: checkbox)
- Match case (en; key: caseSensitive; type: checkbox)
- Keep empty lines (en; key: keepEmpty; type: checkbox)
- Keep the last occurrence (en; key: keepLast; type: checkbox)

## Limitations (en)

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Example input

```text
Hello world.
A second line.
Café, İstanbul, 日本語, and 👨‍👩‍👧‍👦.
```

## Privacy and connections (en)

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

## Questions (en)

### How do I remove duplicate lines while ignoring uppercase and lowercase?

Turn off Match case. Lines that differ only in capitalization are then treated as duplicates, and the copy that is kept retains its original casing. With Match case on, Apple and apple both stay in the list.

### Why are lines with trailing spaces not removed as duplicates?

By default lines are compared exactly, so an extra space at the end makes them different. Enable Trim line edges to strip leading and trailing whitespace before comparing; the trimmed versions are what appear in the output.

### Can I keep the last occurrence of a duplicate line instead of the first?

Yes. In Advanced mode, enable Keep the last occurrence. Each repeated line then stays at the position of its final appearance, and the remaining lines keep their relative order.

### Where is my input processed?

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

### What are the input limits?

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Related tools

- [Sort lines alphabetically](https://www.toolcabana.com/mg/sort-lines)
- [Reading time calculator](https://www.toolcabana.com/mg/reading-time)
- [Remove line breaks](https://www.toolcabana.com/mg/remove-line-breaks)
- [Character counter](https://www.toolcabana.com/mg/character-counter)
