
Extracts a specified number of bytes from the start of a text string. LEFTB is mainly a legacy compatibility function for older DBCS workflows.
The Excel LEFTB function returns a specified number of bytes from the start of a text string. That is different from LEFT, which counts characters. In older Double-Byte Character Set (DBCS) environments, some characters use 2 bytes, so a byte-based result can differ from a character-based result.
Microsoft now treats LEFTB as a legacy compatibility function. In newer Excel versions, LEFT is the preferred function, and Microsoft notes that LEFT now supports Unicode through newer compatibility behavior. So LEFTB is mainly worth learning when you are working with older files, older systems, or lessons about byte-based text handling.
This distinction matters most in workbooks built around older language and encoding rules. A visible character count and a byte count are not always the same thing, so LEFTB exists for cases where storage size mattered more than the number of characters a person sees on screen.
Returns text from the left side, but counts bytes instead of characters.
Returns the left portion of the text based on the byte count you specify.
=LEFTB(text, [num_bytes])
The first argument is the text to extract from. The second argument is the number of bytes to return. If you omit num_bytes, Excel uses 1. In byte-based languages, that can matter because one visible character may take more than one byte.
The difference is simple: LEFT counts characters, while LEFTB counts bytes. For plain single-byte text like "ABC", the two functions usually give the same result. For full-width or DBCS text, they may return different results.
| Sample Text | Count | LEFT Result | LEFTB Result |
|---|---|---|---|
| "ABC" | 2 | "AB" | "AB" |
| "AB" | 2 | "AB" | "A" |
| "こんにちは" | 4 | "こんにち" | "こん" |
When LEFTB is used on multi-byte text, Excel returns whole characters only. If the requested byte count would cut through the middle of a character, Excel does not return half of that character.
LEFTB appears mainly in legacy spreadsheets that were designed around byte limits instead of character limits. For example, an older export file may allow only a fixed number of bytes in a field. In that case, LEFTB can trim the text to the allowed byte width before export.
In modern workbooks, LEFT is usually the better first choice. Use LEFTB only when the requirement is specifically about bytes, not just visible characters.
With plain ASCII text, each character is effectively counted one byte at a time, so LEFTB behaves much like LEFT. Asking for 3 bytes from "ABC" returns the whole string.
=LEFTB(A1, 3) // Returns "ABC"
In cell B1, extract the first 3 bytes from A1.
This example shows why LEFTB exists. In full-width text, one visible character can take 2 bytes. So a byte count of 2 returns only the first full-width character, not two characters.
=LEFTB(A2, 2) // Returns one full-width character
In cell B2, extract the first 2 bytes from A2.
In Japanese text, LEFTB follows the byte count rather than the character count. If each character uses 2 bytes in the DBCS context, asking for 4 bytes returns the first two characters.
=LEFTB(A3, 4) // Returns the first 2 Japanese characters
In cell B3, extract the first 4 bytes from A3.
The byte count does not need to be typed directly into the formula. You can store it in a cell and let the formula read it. That makes the extraction rule easier to adjust later.
=LEFTB("ABCDEFGHI", A4) // If A4 is 5, returns "ABCDE"
In cell B4, use the number in A4 as the byte count when extracting from the text row.
The main thing to remember is that LEFTB is not the normal choice in modern Excel work. It exists for compatibility with byte-based text handling. If your task is about visible characters, use LEFT. If your task is about byte limits in older DBCS-style workflows, LEFTB may still be relevant.
LEFTB is the byte-based version of LEFT, so it matters mostly in older workflows where field limits were measured in bytes instead of visible characters. This lesson showed that for plain text it may look the same as LEFT, but for double-byte text the result can be different.
The main beginner takeaway is simple: in modern Excel work, LEFT is usually the right choice. LEFTB is mostly for compatibility with older systems or older files where byte count is the real rule, not character count.
LEFTB returns text from the left side based on bytes, not characters.=LEFTB(text, [num_bytes]).Tell your friends about this post