LENB

    Text

    Returns the number of bytes used to represent the characters in a text string. Each double-byte character (DBCS, used in Japanese, Chinese, Korean) counts as 2; each single-byte character counts as 1.

    Translations
    EnglishLENB
    FrenchNBCARB
    SpanishLARGOB
    GermanLÄNGEB
    ItalianLUNGHEZZAB
    PortugueseNÚM.CARACTB
    DutchLENGTEB
    PolishDŁ.B
    RussianДЛСТРБ
    TurkishUZUNLUKB
    CzechDÉLKAB
    HungarianHOSSZB
    SwedishLÄNGDB
    DanishLÆNGDEB
    FinnishPITUUSB
    Syntax
    LENB(text)

    Arguments

    • textThe text whose byte length you want to measure. Spaces count as characters.
    Examples
    =LENB("Excel")
    5

    5 single-byte characters = 5 bytes

    =LENB("日本")
    4

    Each double-byte character counts as 2 bytes

    =LENB("AB日")
    4

    2 single-byte + 1 double-byte = 4 bytes

    Tips & Best Practices
    • On systems without DBCS language support, LENB returns the same as LEN
    • Use LEN to count characters regardless of byte width
    • Mainly relevant when handling East Asian text
    • Helpful when validating data length against database byte limits
    Common Mistakes
    • Assuming LENB always returns the same result as LEN - they only match when the text contains no double-byte characters, and diverge as soon as Japanese, Chinese, or Korean characters are present
    • Using LENB to count characters for display or layout purposes when LEN (which counts characters, not bytes) is actually what's needed
    • Forgetting that spaces and punctuation count as single-byte characters just like Latin letters, so a string mixing scripts needs careful byte accounting rather than a simple assumption
    Related Functions
    LENCounts characters regardless of byte width, giving a different (usually smaller) result than LENB whenever double-byte characters are present.
    LEFTBExtracts a substring based on byte count, using the same byte-counting logic that LENB measures.
    MIDBExtracts a substring starting at a specific byte position, relying on the same double-byte-aware counting as LENB.
    Frequently Asked Questions

    Why does LENB give a different result than LEN for the same text?

    LENB counts bytes, and double-byte characters (common in Japanese, Chinese, and Korean text) count as 2 bytes each, while LEN always counts them as a single character. The two only match when text contains exclusively single-byte characters.

    When would I actually need LENB instead of LEN?

    When validating text length against a byte-based limit, like a database field or a legacy system that measures storage by bytes rather than character count.

    What happens if my system doesn't support double-byte character sets?

    LENB behaves identically to LEN in that case, since there are no double-byte characters for it to count differently.

    Need to translate a formula using LENB?

    Use our translator to convert your complete formula