What Is the Master Boot Code?

Definition of Master Boot Code & Help Fixing Master Boot Code Errors

The master boot code (sometimes abbreviated as MBC) is one of the several parts of the master boot record. It performs the first set of important functions in the process of booting.

Specifically, in the typical generic master boot record, the master boot code consumes 446 bytes of the total 512-byte master boot record—the remaining space is used by the partition table (64 bytes) and the 2-byte disk signature.

Red cube that fits into a larger beige cube

Anthony Bradshaw / Photographer's Choice / Getty Images

How the Master Boot Code Works

Assuming the master boot code is executed properly by BIOS, the master boot code hands off booting control to the volume boot code, part of the volume boot sector, on the partition on the hard drive that contains the OS.

A master boot code is used only on primary partitions. Non-active partitions like those on an external drive that may store data like file backups, for example, don't need to be booted from because they don't contain an operating system and therefore have no reason for a master boot code.

These are the actions the master boot code follows, according to Microsoft:

  1. Scans the partition table for the active partition.

  2. Finds the starting sector of the active partition.

  3. Loads a copy of the boot sector from the active partition into memory.

  4. Transfers control to the executable code in the boot sector.

The master boot code uses what's called CHS fields (Starting and Ending Cylinder, Head, and Sector fields) from the partition table to locate the boot sector portion of the partition.

Master Boot Code Errors

Files that Windows needs to boot to the operating system can sometimes become corrupt or go missing. Master boot code errors can happen due to anything from a virus attack that replaces the data with malicious codes, to physical damage to the hard drive.

Identifying Master Boot Code Errors

One of these errors are likely displayed if the master boot code can't find the boot sector, preventing Windows from starting:

  • Missing operating system
  • Invalid partition table
  • Error loading operating system
  • MBR Error 1
  • MBR Error 2

One solution for these errors is to reinstall Windows. While this may be your first thought because you don't want to go through the process of fixing the error, it's a rather drastic solution.

Let's look at a few other, potentially more simple, ways to fix these problems:

How to Fix Master Boot Code Errors

While you can normally open a Command Prompt to run commands in Windows, problems with the master boot code likely mean that Windows won't start. In these cases, you'll need to access a Command Prompt from outside of Windows...

In Windows 11, Windows 10, Windows 8, Windows 7, and Windows Vista, you can attempt to fix a master boot code error by rebuilding the Boot Configuration Data (BCD) using the bootrec command.

The command is available in Windows 11/10/8 through Advanced Startup Options. In Windows 7 and Vista, it's done via System Recovery Options.

In Windows XP and Windows 2000, the fixmbr command is used for building a new master boot record by re-writing the master boot code. This command is available in Recovery Console.

Was this page helpful?