# CLEAN function in Excel

> CLEAN removes non-printing characters, such as line breaks and tabs, from text.

Source: https://spreadsheetpractice.com/functions/clean · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** CLEAN removes non-printing characters, such as line breaks and tabs, from text.
- **Syntax:** `=CLEAN(text)`
- **Most common use:** `=CLEAN(A2)` returns Maya Chen (The trailing line break is gone)
- **Available in:** Every current version
- **Category:** [Text functions](https://spreadsheetpractice.com/functions/category/text)
- **Returns:** Text with the non-printing characters (codes 0 to 31) removed.

## What it does

CLEAN removes non-printing characters, such as line breaks and tabs, from text. Use it on data pasted from other systems, where hidden characters make cells look identical but fail to match, or push text onto a second line.

## Syntax

`=CLEAN(text)`

| Argument | Required? | What it is |
|---|---|---|
| `text` | Required | The text or cell to clean. |

## Examples

Each result was calculated by running the formula on the sample sheet.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | `=CLEAN(A2)` | Maya Chen | The trailing line break is gone |
| D3 | `=LEN(C3)-LEN(CLEAN(C3))` | 1 | One hidden character found in the code |
| D4 | `=CLEAN(B4)` | 5 Elm RdUnit B | Removing a line break joins the words; use SUBSTITUTE if you need a separator |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C | D |
|---|---|---|---|---|
| 1 | Imported name | Address | Code | Result |
| 2 | Maya Chen | 12 Oak St Apt 4 | WDG-01 | Maya Chen |
| 3 | Raj Patel | 88 Pine Ave | GDT-02 | 1 |
| 4 | Lee Wong | 5 Elm Rd Unit B | GZM-03 | 5 Elm RdUnit B |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| Nonbreaking spaces remain | CLEAN only removes codes 0 to 31. The nonbreaking space (160) survives; replace it with SUBSTITUTE(A2,CHAR(160)," "). |
| Words run together | Deleting a line break doesn't add a space, so "Rd" and "Unit B" become "RdUnit B". Swap the break for a space instead: =SUBSTITUTE(A2,CHAR(10)," "). |

## Tips

- Pair it with TRIM: =TRIM(CLEAN(A2)) handles most messy imports in one step.

## Related functions

- [TRIM](https://spreadsheetpractice.com/functions/trim): TRIM removes spaces from the start and end of text and shrinks runs of spaces between words to one.
- [SUBSTITUTE](https://spreadsheetpractice.com/functions/substitute): SUBSTITUTE replaces specific text with new text everywhere it appears, or only at the occurrence you choose.
- [CHAR](https://spreadsheetpractice.com/functions/char): CHAR returns the character for a code number.

## Questions

### What does CLEAN do in Excel?

It strips non-printing characters (codes 0 to 31), such as line breaks, tabs and carriage returns, from text.

### How do I remove line breaks in Excel?

Use =CLEAN(A2) to delete them, or =SUBSTITUTE(A2,CHAR(10)," ") to turn each break into a space so words don't run together.

## Practice

A graded CLEAN exercise ("Strip hidden characters") is on [the CLEAN page](https://spreadsheetpractice.com/functions/clean). It is checked instantly, then re-checked on changed data.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
