LEFTB Function

Excel Functions › Text

All Excel versions DBCS languages

The Excel LEFTB function returns the first part of a text string measured in bytes rather than characters. It exists for double-byte character set (DBCS) languages — Japanese, Chinese, and Korean — where each native character counts as 2 bytes when such a language is the system default. Working in English or any other single-byte language? LEFTB behaves exactly like LEFT — just use LEFT. This page is for the byte-counting cases.


Quick answer: to take the first 4 bytes of A2:
=LEFTB(A2, 4) // first 4 bytes - 2 kanji, or 4 Latin characters
On a Japanese/Chinese/Korean system locale, each DBCS character costs 2 bytes. Everywhere else, LEFTB counts characters and is identical to LEFT.

Syntax

=LEFTB(text, [num_bytes])
ArgumentDescription
textRequiredThe string to extract from.
num_bytesOptionalHow many bytes to return, counted from the left. Default is 1. Must be zero or positive.

Available in: all Excel versions. Byte counting activates only when a DBCS language (Japanese, Chinese Simplified/Traditional, or Korean) is the system default language; otherwise every character counts as 1 byte and LEFTB returns exactly what LEFT would.

LEFTB vs LEFT: bytes vs characters

On a Japanese-locale system, the string 東京2026 occupies 8 bytes: two 2-byte kanji followed by four 1-byte digits. Watch the two functions diverge:

ABC
1Text in A2: 東京2026FormulaResult (Japanese locale)
2byte layout: [2][2][1][1][1][1]=LEFTB(A2, 4)東京
3=LEFT(A2, 4)東京20
4=LEFTB("Dallas", 3)Dal — same as LEFT
=LEFTB(A2, 4) // 4 bytes = the two kanji only
=LEFT(A2, 4) // 4 characters = both kanji plus "20"

This is the point of LEFTB: fixed-width files and legacy databases from East Asian systems specify field sizes in bytes, so “the first 10 bytes” is the spec — LEFTB honours it, LEFT can’t.

=LEFTB(A2, 10) // cut a 10-byte field from a legacy record

Try it: char vs byte counter

Live demo

Type text (mix in some kanji or kana), choose num_bytes, and toggle the system locale to see when LEFTB stops matching LEFT.

Errors & common pitfalls

Pitfall: results depend on the system language, not the workbook. The same =LEFTB(A2, 4) returns 東京 on a Japanese-locale PC and 東京20 on a US-locale PC. If a file travels between offices, byte-based formulas silently change meaning — document the assumption, or avoid B functions in shared files.

Working in English? Use LEFT. On single-byte locales LEFTB adds no capability — it’s LEFT with a misleading name. Reach for LEFT and your formulas stay portable.

Pitfall: cutting a character in half. If num_bytes lands in the middle of a 2-byte character, LEFTB returns a space in its place: =LEFTB("東京", 3) gives 東 followed by a space, never half a kanji. Watch for surprise trailing spaces in concatenations.

#VALUE! — negative num_bytes. num_bytes must be zero or greater. A computed length that goes negative (say, FINDB(...)-2) is the usual culprit — guard it with MAX(0, ...).

Practice workbook

📊
Download the free LEFTB practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between LEFTB and LEFT?
LEFT counts characters; LEFTB counts bytes. They differ only when a DBCS language (Japanese, Chinese, Korean) is the system default — then each East Asian character costs 2 bytes, so =LEFTB("東京2026", 4) returns just the two kanji while =LEFT(..., 4) returns the kanji plus two digits.
Why does LEFTB give me the same answer as LEFT?
Because your system default language isn’t a DBCS language. Outside Japanese/Chinese/Korean locales, Excel counts every character as one byte, making LEFTB and LEFT identical. That’s expected — and a good reason to simply use LEFT.
When should I actually use LEFTB?
When a field width is defined in bytes: fixed-width exports from Japanese/Chinese/Korean mainframes and ERP systems, database columns sized in bytes (VARCHAR(20) meaning 20 bytes), or any spec written for legacy DBCS encodings. For everyday text slicing, use LEFT — or TEXTBEFORE in Excel 365.
What happens if num_bytes splits a double-byte character?
Excel never returns half a character. The orphaned half becomes a space, so =LEFTB("東京", 3) returns 東 plus one space (still 2 visible positions). Trim the result if trailing spaces would pollute downstream formulas.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: LEFT · RIGHTB · MIDB · LENB · FINDB