
Returns the number of bytes used by a text string. LENB is mainly a legacy compatibility function for older DBCS workflows.
The Excel LENB function returns the number of bytes used by a text string. That is different from LEN, which counts characters. In older Double-Byte Character Set (DBCS) environments, some characters use more than one byte, so LENB can return a larger value than LEN.
Microsoft now treats LENB as a legacy compatibility function. In current Excel guidance, LEN is the preferred modern function, with updated behavior available through compatibility settings. So LENB is mainly useful when you are working with older spreadsheets or byte-based requirements.
Returns the storage length of text in bytes rather than the visible character count.
Returns a numeric byte count such as 5, 6, or 10.
=LENB(text)
LENB takes one argument: the text you want to measure in bytes. With plain single-byte text, LENB often matches LEN. With older DBCS-style text handling, the result may be different because one character can use more than one byte.
LEN counts characters. LENB counts bytes. For standard Western text, the two often match. For full-width or DBCS text, LENB may return a larger number.
| Sample Text | LEN Result | LENB Result |
|---|---|---|
| "Excel" | 5 | 5 |
| "123" | 3 | 6 |
| "こんにちは" | 5 | 10 |
LENB appears mostly in older workflows where field limits were measured in bytes instead of visible characters. That can matter in legacy imports, exports, and older systems that expect a fixed byte width.
In modern workbooks, LEN is usually enough. Use LENB only when the requirement is explicitly about bytes, or when you are maintaining an older file that already depends on byte-based logic.
With plain text like "Hello", LENB behaves much like LEN. Each character contributes one byte in the older single-byte model.
=LENB("Hello") // Returns 5
Count bytes in "Excel". Formula: =LENB("Excel").
Full-width characters may look similar to normal characters, but they can take more storage space. In a byte-based count, that means LENB can return a value that is twice the character count.
=LENB("123") // Returns 6
Count bytes in "Excel". Formula: =LENB("Excel").
Subtracting LEN from LENB is a simple way to see whether the text uses more bytes than characters. If the result is greater than 0, the value likely contains multi-byte characters in that compatibility model.
=LENB(B2)-LEN(B2) // Returns the byte difference
Find whether B2 has a different LEN and LENB. Formula: =LENB(B2)-LEN(B2).
You can wrap LENB and LEN inside IF to build a quick flag. This is useful when you need to separate standard single-byte text from values that may cause issues in an older export process.
=IF(LENB(A1)>LEN(A1),"DBCS Found","Standard")
Check whether A1 uses more bytes than characters. Formula: =IF(LENB(A1)>LEN(A1),"DBCS Found","Standard").
The main thing to remember is that LENB is no longer the usual choice in modern Excel work. It remains relevant when you are dealing with older byte-based rules, not when you simply want a character count.
LENB counts bytes, not characters.=LENB(text).Tell your friends about this post