How to Use the LEN Function in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 4 min read · includes 2 free exercises

In short: LEN returns the number of characters in a text. The formula is =LEN(text). It counts every character, including spaces and nonprinting characters.

What LEN does

LEN counts characters. People use it to check a length limit (a product title, a tweet, an ID), to find cells with hidden extra spaces, and as a building block inside LEFT, RIGHT and MID formulas.

LEN syntax

=LEN(text)

Google's help page says LEN counts all characters, even spaces and nonprinting characters. If LEN returns a value you did not expect, check whether the text contains extra spaces or nonprinting characters.

A step-by-step example

Cell A2 holds the text Hello world.

A
1Text
2Hello world
=LEN(A2)

This returns 11: ten letters and one space. You can also pass text directly in quotation marks, as the help page does with LEN("lorem ipsum").

Find hidden spaces

If a cell shows 5 letters but LEN says 7, two spaces are hiding in it. A lookup that "should" match can fail for exactly this reason. TRIM removes the extra spaces. Compare LEN(A2) with LEN(TRIM(A2)) to find the affected cells.

Common mistakes

Try it yourself

Use the cell above (A2). Type your formula into the box, starting with =, then press Check.

Exercise 1: Count the cell

Write a formula that returns the number of characters in the text in A2.

Hint: pass the cell reference.

Exercise 2: Count typed text

Write a formula that counts the characters in the text Google Sheets typed directly into the formula.

Hint: put the text in quotation marks.

What to learn next

Syntax and rules in this guide were checked against Google's LEN help page. See all guides.