FreeToolPark

How many bytes in a megabyte?

By Updated

A byte is the fundamental unit of computer storage, roughly the amount needed to hold one character of text. A megabyte is 2 to the 20th power bytes (1,048,576) when using binary units, the system built into how computers actually address memory. It is 1 million bytes flat when using decimal SI units, which is what gets printed on boxes and in marketing material.

For any practical work with files on a computer, use 1,048,576. A 5 MB image really is about 5,242,880 bytes on disk. For comparing marketed storage capacity or calculating internet bandwidth, use 1,000,000. A 100 Mbps connection moves 100,000,000 bits (or 12.5 million bytes) per second.

Quick reference: Megabytes to Bytes

Megabytes (MB)Bytes (B)
0.5524,288
11,048,576
22,097,152
55,242,880
1010,485,760
2526,214,400
5052,428,800
100104,857,600

Worked examples

  1. Example 1: Your text file is 500 KB. How many bytes is that?

    Calculation: 500 KB × 1,024 bytes/KB = 512,000 bytes (binary). Or 500 KB × 1,000 = 500,000 bytes (decimal).

    Most file explorers use binary, so your text file is likely 512,000 bytes on disk.

  2. Example 2: An API response is 2.5 MB. Your monthly API quota is in bytes, at 1,000,000,000 bytes.

    Calculation: 2.5 MB × 1,048,576 = 2,621,440 bytes per call. Quota allows 1,000,000,000 ÷ 2,621,440 = 381 calls.

    You get roughly 381 API calls per month at this response size.

  3. Example 3: A log file grows by 1 byte per entry and you want to know how many entries fit in 1 MB.

    Calculation: 1 MB = 1,048,576 bytes = 1,048,576 single-byte entries.

    About 1.05 million entries fit in a megabyte if each one is exactly 1 byte.

Frequently asked questions

Is 1 MB exactly 1,000,000 bytes?

Only in decimal SI units. In binary (which computers actually use), 1 MB = 1,048,576 bytes. The ~5% difference matters on spec sheets.

How many bytes in a KB?

1 KB = 1,024 bytes in binary, or 1,000 bytes in decimal. Operating systems use binary. A 10 KB file is 10,240 bytes in Windows or macOS.

Why are there two definitions of a megabyte?

Computers are built around powers of 2 because memory is addressed in binary. Using 1,024 made sense for engineers. Later, marketing and SI standards pushed for 1,000,000 for consistency with other metric prefixes. The industry never fully agreed on one, so both coexist.

What is a mebibyte (MiB)?

A mebibyte is the binary megabyte: exactly 1,048,576 bytes. The term was created by the IEC to eliminate ambiguity. Despite being technically correct, almost nobody uses MiB in everyday writing.

How many megabytes are in a gigabyte?

1 GB = 1,024 MB in binary or 1,000 MB in decimal.

How many bytes in 5 megabytes?

5 MB = 5,242,880 bytes in binary or 5,000,000 bytes in decimal.

Related answers

← Back to all answers