Category: FUNCTION | Updated: 2026-11-22

How to Use the CLEAN Function in Google Sheets | Remove Non-Printable Control Characters

How to Use the CLEAN Function

The CLEAN function is a Google Sheets text function that removes non-printable control characters (ASCII codes 0–31) from a text string.

Syntax

=CLEAN(text)
  • text: The text string or cell reference from which to remove non-printable control characters (required).

Examples

Here is an example of removing in-cell line breaks from imported data to format it onto a single line.

Row Column A (Source Data) Column B (Formula) Column C (Result)
1 Source Data Formula Result
2 Tokyo
Shinjuku
=CLEAN(A2) TokyoShinjuku
3 Product A
(Limited Edition)
=CLEAN(A3) Product A(Limited Edition)
  • Explanation: The line break character (ASCII code 10) inside the cells in Column A is removed, turning each entry into a clean single-line string.

Common Errors and Tips

  • Regular and full-width spaces are not removed: CLEAN only targets control characters, so standard spaces remain. To remove extra spaces as well, nest it with TRIM, such as =TRIM(CLEAN(A2)).
  • Some Unicode invisible characters may remain: Special Unicode characters outside ASCII 0–31 (such as non-breaking spaces) are not removed by CLEAN; use SUBSTITUTE if needed.
  • If you want a space where the line break was: CLEAN deletes line breaks without leaving a space. To separate words with a space instead, use =SUBSTITUTE(A2, CHAR(10), " ").

Frequently Asked Questions

Q. What are the "non-printable characters" removed by CLEAN?

A. They are control characters corresponding to ASCII codes 0 through 31 (such as in-cell line breaks, tabs, and bell characters). CLEAN helps strip unwanted codes often introduced when pasting CSV or web data from external systems.

Q. What is the difference between CLEAN and TRIM?

A. CLEAN removes control characters like line breaks and tabs, while TRIM removes leading, trailing, and extra consecutive spaces. They are commonly used together.