# How do I find out how many bytes of memory my machine has in RAM?

macOS Sierra's System Information.app tells me I have 12GB of RAM: two 4GB modules and two 2GB modules.

But I am aware of the following:

• macOS might use either base 10 or base 2 to express RAM sizes. (https://support.apple.com/en-us/HT201402 only talks about storage, not RAM)
• RAM is physically designed such that the actual number of bytes might not be a power of 2. It could, for example, be a multiple of some power of 2.

These are both uncertainties, not facts. In order for me to calculate how many bytes I have, I need to know whether OS X is using gigabytes or gibibytes, and whether I need to use multiples of them or powers of them.

Thanks!

• Why does it actually matter? is there some underlying problem you're trying to solve? Otherwise it's a bit "how big is a pint?'... the answer being dependent on whether or not you consider the froth on top to be part of the pint or not... [beer vs milk ref] – Tetsujin May 25 '17 at 20:18
• Totally agree with @Tetsujin - I have tested an awful lot of RAM over the years and the number of bytes is always in the range of +- 0.8% (approximately as I'm rounding to 1 decimal place). Only this week I did a 9.5 hr test of 12GB RAM in an old iMac. 12GB should be 12,884,901,888 bytes. In this case the user had 12,777,527,706 bytes. Doing the maths, that's a difference of 107,374,182 bytes. That may sound like a lot, but it only equates to about 0.09GB. Remember, I've seen values above and below, and the difference is always negligible. – Monomeeth Jun 24 '17 at 2:42

RAM is always calculated in `base 2`.

In Terminal:

``````sysctl hw.memsize
``````

The output will be in bytes.

• Even if you compute the base ten size, the design is such that the size is always an integer times a power of two. – WGroleau May 26 '17 at 8:05

Apparently, computer memory architecture (the RAM) is always binary (base 2)

Wikipedia Byte