Quick Answer

LENB Function

Returns the byte length of text.

✓ Excel✓ Google SheetsExcel All versions

Syntax

LENB
(text)

Parameters

ParameterDescriptionRequired
textThe text or cell reference whose byte count is returned.Required

Basic Example

Byte length of ASCII text

=LENB("Hello")
Result5

Each ASCII character is one byte, so the byte count equals the character count of 5.

Advanced Examples

Example 1: DBCS text in Excel

Cell A1 contains the two Chinese characters "你好" and Excel runs in a DBCS locale

Each character counts as two bytes

=LENB(A1)
Result: 4
Under a DBCS-enabled Excel, each Chinese character is two bytes, so two characters equal 4 bytes.

Example 2: Detect double-byte content

Compare LEN and LENB on mixed text

When LENB > LEN, the string has multi-byte characters

=LENB(A1)-LEN(A1)
Result: Positive number for DBCS text
The difference reveals how many extra bytes come from multi-byte characters.

How LENB Works

LENB counts the storage bytes of the string. In Excel's DBCS language editions, East Asian characters occupy two bytes while ASCII occupies one; in single-byte editions every character is one byte, making LENB identical to LEN.

1
Select the text
Click the cell with the text to measure.
2
Apply LENB
Type =LENB(cell) and press Enter.

Important Notes & Limitations

  • In Excel on single-byte systems LENB always equals LEN, so it is only useful in DBCS locales.

  • Google Sheets counts bytes using UTF-8, where many non-ASCII characters are 2-3 bytes, differing from Excel's DBCS behavior.

  • Does not count formatting or formula length, only the resulting text value.

Common Errors & Fixes

LENB equals LEN unexpectedlyRunning Excel in a single-byte locale where every character is one byte.

Fix: Use the difference LENB-LEN only on DBCS-enabled Excel, or rely on Google Sheets' UTF-8 counts for web data.

Download Practice File

Practice LENB with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the LENB function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

When does LENB differ from LEN?
Only for multi-byte (DBCS) characters in a DBCS edition of Excel; otherwise they are equal.
How does Google Sheets handle LENB?
Sheets uses UTF-8 byte counts, so East Asian characters usually count as 3 bytes each.
Why would I use LENB?
To detect or handle multi-byte character data when processing DBCS text.