Bytes to MB Converter
Convert a raw byte count to megabytes. Choose binary (1 MB = 1,048,576 bytes) for OS and programming use, or decimal (1 MB = 1,000,000 bytes) for storage specs and network reporting.
Bytes to MB Converter
Convert bytes to megabytes with decimal (SI) and binary (IEC) conversion standards.
Result
Enter a value and click "Convert" to see the result
Bytes to MB: Binary vs Decimal
When you read a file size in code (e.g. fs.stat() in Node.js, os.path.getsize() in Python), you always get raw bytes. Dividing by the right number depends on context.
| Bytes | MB (binary) | MB (decimal) |
|---|---|---|
| 500,000 | 0.477 MB | 0.5 MB |
| 1,000,000 | 0.954 MB | 1.0 MB |
| 1,048,576 | 1.0 MB | 1.049 MB |
| 5,000,000 | 4.768 MB | 5.0 MB |
| 10,000,000 | 9.537 MB | 10.0 MB |
Quick Reference: Conversion Formulas
- Binary (OS / programming): MB = bytes ÷ 1,048,576
- Decimal (storage / network): MB = bytes ÷ 1,000,000
- JavaScript:
const mb = bytes / 1048576 - Python:
mb = bytes / 1_048_576
Frequently Asked Questions
How many bytes are in 1 MB?
Binary (IEC) standard — used by operating systems: 1 MB = 1,048,576 bytes (= 1,024²). Decimal (SI) standard — used by storage manufacturers: 1 MB = 1,000,000 bytes (= 1,000²). In most programming contexts and OS file size reporting, 1 MB = 1,048,576 bytes.
How do I convert bytes to MB in code?
Binary (most common in code): MB = bytes / 1_048_576. Decimal: MB = bytes / 1_000_000. In JavaScript: const mb = bytes / 1048576. In Python: mb = bytes / 1048576. Use the binary formula unless you are specifically working with SI units (e.g., for network throughput reporting).
How many bytes is a 5 MB file?
Binary: 5 × 1,048,576 = 5,242,880 bytes. Decimal: 5 × 1,000,000 = 5,000,000 bytes. When your OS shows a file as '5 MB', it means 5,242,880 bytes using the binary standard.
What is a mebibyte (MiB)?
A mebibyte (MiB) is exactly 1,048,576 bytes — the binary megabyte. The IEC introduced the MiB term in 1998 to remove ambiguity. In practice, most operating systems still label binary values as 'MB' instead of 'MiB', so when Windows, macOS or Linux says a file is '10 MB', it actually means 10 MiB (10,485,760 bytes).
Why does my download manager show a different file size than my OS?
Download managers often use decimal bytes (1 MB = 1,000,000 bytes) for speed reporting, while your OS uses binary (1 MB = 1,048,576 bytes) for file size display. A file downloaded as '100 MB' in a browser will appear as ~95.37 MB on disk in Windows. Both values are correct — they use different standards.