
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.
LENB is not really about visible text length. It is about storage-style length under older encoding rules. In the few situations where byte size still matters, comparing LENB and LEN can help explain why two strings that look similar may behave differently in older systems or imported files.
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(A1) // Returns 5
In cell B1, count bytes in A1.
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(A2) // Returns 6 in a DBCS-style setup
In cell B2, count bytes in A2.
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(A3)-LEN(A3) // Returns the byte difference
In cell B3, compare LEN and LENB for A3.
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(A4)>LEN(A4),"DBCS Found","Standard")
In cell B4, check whether A4 uses more bytes than characters and show a label for multi-byte text.
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 is the byte-count version of LEN, so it is mostly useful when an older workflow cares about storage bytes instead of visible character count. This lesson showed that it can return a bigger number than LEN when the text includes double-byte characters.
The practical rule is simple: if you are doing normal modern Excel text work, use LEN. If you are maintaining a legacy file or checking a byte-limited field, LENB can still matter. The difference only becomes important when bytes, not characters, are the real limit.
LENB counts bytes, not characters.=LENB(text).Tell your friends about this post