Reading MiB in Linux Tools: free, df, du and ls Output Explained

Linux commands often report sizes in MiB even when they print "M". Learn which tools use binary units, how to switch to MB, and how to convert MiB to MB.

Updated September 29, 2026 5 min read

Use the free MiB to MB ConverterConvert binary mebibytes to decimal megabytes for RAM and file sizes

You run ls -lh on a file and see 9.8M. The upload form you are using says the limit is 10 MB. It should fit, but the upload is rejected. Or free -m says a server has 7,821 of something, top says MiB Mem, and the cloud console says 8 GB. None of these tools are wrong; they are counting in mebibytes (MiB) while the other side counts in megabytes (MB), and the single letter "M" hides the difference.

This guide explains which common Linux commands report binary units, which flags switch them to decimal, and how to convert MiB to MB so you can compare numbers across tools.

MiB and MB

  • 1 MB (megabyte) = 1,000,000 bytes
  • 1 MiB (mebibyte) = 1,048,576 bytes (1,024 × 1,024)

So:

MB  = MiB × 1.048576
MiB = MB × 0.953674
MiB MB
1 1.049
7.5 7.864
100 104.858
256 268.435
512 536.871
1,024 1,073.742
2,048 2,147.484
4,096 4,294.967

Going the other way, 100 MB is 95.37 MiB and 1,000 MB is 953.67 MiB. The gap is about 4.9%.

Which tools print which units

Behaviour can vary between versions and distributions, so check man pages on your system. On typical GNU/Linux systems:

Command Default human-readable units Decimal option
ls -lh binary (K, M, G = KiB, MiB, GiB) ls -l --si
du -h binary du --si
df -h binary df -H (or --si)
free -m mebibytes free --mega
free -h binary, labelled Mi, Gi free -h --si
top often labelled KiB or MiB in the summary configurable in some versions

The main trap is that ls, du and df print a bare M or G suffix in human-readable mode. That M means MiB. Newer versions of free and top often print explicit Mi or MiB labels, which is clearer.

Converting with the tool

The MiB to MB Converter resolves the numbers quickly:

  1. Open the converter. The left box is labelled Mebibytes (MiB), the right box Megabytes (MB).
  2. Type the value from the command output, for example 9.8 for 9.8M from ls -lh.
  3. Read the result: 9.8 MiB = 10.2760448 MB. That file is over a 10 MB limit.
  4. To check how much room a decimal limit gives you in MiB, type the limit into the MB box. A 10 MB limit is 9.54 MiB.
  5. The list underneath shows the same size in KB, KiB, GB, GiB and bytes, so you can match any other tool.
  6. Copy the result to share in a ticket or chat.

Worked examples

An upload that looks small enough

ls -lh report.pdf shows 9.8M. The web form's limit is 10 MB. Converted, the file is 10.28 MB and will be rejected. ls -l --si would have shown about 11M after rounding up, and ls -l (without -h) shows the exact byte count, which is the most reliable number to compare.

Memory that seems to be missing

A cloud console says an instance has 8 GB of memory. free -m shows a total of something under 8,000. Two effects combine: free -m reports mebibytes, and the kernel reserves some memory for itself and hardware, so the reported total is always a little below the nominal size. Converting the free -m total to MB brings it closer to the console's figure, but not all the way.

Disk usage in reports

A storage report built from du -h says a directory uses 512M, and finance compares it with a cloud storage bill in GB. 512 MiB is 536.87 MB, or about 0.54 GB. Across thousands of directories, the 4.9% difference is enough to make reports disagree.

Other ways to convert

  • Use byte counts: ls -l, du -b and stat -c %s print exact bytes on GNU systems. Bytes are unambiguous.
  • numfmt: on GNU systems, numfmt --from=iec --to=si 512M converts a binary figure to decimal, and the reverse flags convert back.
  • Spreadsheet: =A2*1.048576 for MB from MiB.
  • Mental estimate: add 5% to MiB to get MB. 200 MiB is about 210 MB.

For gigabyte-sized values such as RAM and volumes, GB to GiB handles the next prefix up. For decimal-only conversions, such as an upload limit in KB, use MB to KB or KB to MB.

Tips and pitfalls

Compare like with like

When a limit is in MB and a tool reports MiB, convert one side before comparing, or compare in bytes. Rounding in -h output (which rounds up in GNU tools) adds more uncertainty.

Scripts and parsing

Scripts that parse -h output are fragile. Parse byte counts instead, and format for humans only at the end.

Other operating systems

macOS Finder reports file sizes in decimal units, while many command-line tools on macOS also offer -h with binary units. Windows Explorer uses binary values but labels them KB, MB and GB. If you move files between systems, sizes may appear to change even though the bytes are identical.

Frequently asked questions

Does free -m show MB or MiB?

It shows mebibytes (MiB). Use free --mega for megabytes.

What is the difference between df -h and df -H?

df -h uses powers of 1,024 (binary units), while df -H uses powers of 1,000 (decimal units).

How many MB is 1 MiB?

1 MiB is 1.048576 MB.

Why does ls -lh show a smaller number than the upload site?

ls -lh reports in MiB, which are about 4.9% larger than MB, so the same file shows a smaller number. Convert or compare byte counts.

Which is bigger, MB or MiB?

A MiB is bigger: 1,048,576 bytes versus 1,000,000 bytes.

Try it now: MiB to MB Converter

Loading tool…