File Size: How to Calculate Bytes, KB, MB, and GB
- Decimal megabytes
- MB
- Result
- Binary kibibytes
- KiB
- Result
- Binary mebibytes
- MiB
- Result
This calculator works out a file’s size from its byte count and converts the result into familiar units such as kilobytes, megabytes, and gigabytes. Enter the number of bytes to see the equivalent size using both decimal and binary conventions, which explains why different devices may display slightly different values.
Formula
To convert bytes to a larger unit, divide the byte count by the number of bytes in that unit. Decimal units use powers of 1,000; binary units use powers of 1,024.
- Decimal kilobytes (kB) = bytes ÷ 1,000.
- Decimal megabytes (MB) = bytes ÷ 1,000,000.
- Binary kibibytes (KiB) = bytes ÷ 1,024.
- Binary mebibytes (MiB) = bytes ÷ 1,048,576 (1,024 × 1,024).
In these formulas, bytes is the file size as a whole number of bytes. A byte is a basic unit of digital storage. The calculator rounds displayed conversions to two decimal places; the underlying file size is not rounded or changed.
Worked Example
For the default input of 1,000,000 bytes:
- Decimal kilobytes: 1,000,000 ÷ 1,000 = 1,000 kB.
- Decimal megabytes: 1,000,000 ÷ 1,000,000 = 1.00 MB.
- Binary kibibytes: 1,000,000 ÷ 1,024 = 976.56 KiB, rounded to two decimal places.
- Binary mebibytes: 1,000,000 ÷ 1,048,576 = 0.95 MiB, rounded to two decimal places.
The same byte count is therefore 1,000 kB or 976.56 KiB, depending on the unit convention. The difference is real: 1 kB is 1,000 bytes, while 1 KiB is 1,024 bytes.
What You’ll Need
- The file’s size in bytes. You can usually find it in your computer or phone’s file details, properties, or information panel.
- A calculator or this page’s calculator if you want to convert the value by hand.
If the file manager shows only MB or GB, you can still use that value for an estimate, but it may already be rounded. For an exact conversion, find the byte count or the most precise size the system displays.
Step-by-Step
- Find the file. Open the folder containing it. On a desktop, open the file’s properties or information panel; on a phone or tablet, look for a file-details option. The menu names vary by operating system.
- Record the size and unit. Note whether the value is in bytes, kB, MB, GB, KiB, MiB, or another unit. Do not treat a number shown in MB as though it were a number of bytes.
- Enter a byte count in the calculator. If your file details give bytes, enter that number directly. The default is an example, so replace it with the size you found. Use digits only if the input expects a number; do not type unit labels or thousands separators unless the field accepts them.
- Convert a displayed value to bytes first, if necessary. For decimal units, multiply kB by 1,000, MB by 1,000,000, or GB by 1,000,000,000. For binary units, multiply KiB by 1,024, MiB by 1,048,576, or GiB by 1,073,741,824. Then enter the resulting bytes.
- Read the output that matches your purpose. Use kB or MB for decimal measurements and KiB or MiB for binary measurements. The calculator shows both so you can compare them without mixing conventions.
- Keep the original precision for comparisons. Two-decimal displays are convenient, but close file sizes can look equal after rounding. Compare exact byte counts when the distinction matters, such as checking whether a file fits a storage limit.
Common Mistakes
- Assuming KB and KiB mean the same thing. In strict usage, kB is 1,000 bytes and KiB is 1,024 bytes. Some software uses familiar labels loosely, so check how that program defines its units.
- Using the wrong multiplier. A decimal MB contains 1,000,000 bytes; a binary MiB contains 1,048,576 bytes. Applying one convention to a value from the other gives an inaccurate conversion.
- Entering a rounded display as an exact number. A file shown as 2.4 MB may have a more precise underlying size. Converting the displayed value cannot recover digits that were omitted.
- Confusing file size with storage capacity. A file’s size is not necessarily the amount of free space remaining, nor does it include every filesystem or device overhead. Allow room for other files and system needs.
- Mixing bits and bytes. A lowercase b commonly denotes a bit, while uppercase B denotes a byte; one byte equals eight bits. Internet transfer speeds are often written in bits per second, unlike file sizes, which are generally in bytes.
Tips
- For a quick mental estimate, divide bytes by 1,000 for decimal kB or by about 1,000,000 for decimal MB. Use the exact divisors when accuracy matters.
- Use binary prefixes—KiB, MiB, and GiB—when a program explicitly reports sizes in powers of 1,024. Use decimal prefixes—kB, MB, and GB—when the stated convention is powers of 1,000.
- When estimating how many files fit on a drive, divide usable capacity by file size only as a rough estimate. Formatting, existing data, and varying file sizes reduce the number that will actually fit.
- Keep the unit label with every number you write down. “500” alone is ambiguous; “500 kB” and “500 KiB” are different sizes.
Troubleshooting
The result is far larger or smaller than expected: check that you entered bytes, not a number already expressed in MB or GB. Also verify that you selected the correct decimal or binary convention.
The calculator rejects the input: enter a non-negative whole number of bytes. Remove text such as “MB,” spaces, or commas if the input does not accept them. A file’s byte count cannot be negative.
Your computer reports a different size: it may be using a different unit convention or rounding the display. Compare the exact byte count, if available, rather than comparing rounded MB and MiB values.
The file’s size changes after saving or downloading: check that you are comparing the same file version and that the transfer or export completed. Compression, conversion, edits, or metadata changes can alter a file’s byte count.
Frequently Asked Questions
How do I calculate file size in MB?
For decimal MB, divide bytes by 1,000,000. For binary MiB, divide bytes by 1,048,576. Check which unit convention your software uses.
How many bytes are in a kilobyte?
A decimal kilobyte (kB) is 1,000 bytes. A kibibyte (KiB), a separate binary unit, is 1,024 bytes.
Why does a file show different sizes on different devices?
Devices or apps may use decimal versus binary units, round displayed values differently, or show allocated storage rather than the exact file length.
What is the difference between file size and size on disk?
File size is the number of bytes in the file’s contents. Size on disk is the storage space allocated to it and can be larger because storage is assigned in blocks.
Can I calculate a file’s size without opening it?
Usually. A file manager can show size in its details or properties without opening the contents. The exact steps depend on your device and operating system.
Is a megabyte the same as a mebibyte?
No. A decimal megabyte (MB) is 1,000,000 bytes; a mebibyte (MiB) is 1,048,576 bytes.
Related
Formula used
in bytes | File size | bytes | 1000000 | 0 out decimal_kb | Decimal kilobytes | kB | bytes / 1000 | 2 out decimal_mb | Decimal megabytes | MB | bytes / 1000000 | 2 out binary_kib | Binary kibibytes | KiB | bytes / 1024 | 2 out binary_mib | Binary mebibytes | MiB | bytes / 1048576 | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.