Is there a simple way to typeset byte units like MB, GB, TB in latex in math mode? How do you typeset 1GB for example?


2 Answers 2


You can use siunitx, which supports both SI and binary prefixes (the latter, via the package option binary-units).

You can even define your own units via \DeclareSIUnit (though that is not necessary here since binary units are already defined in the library). Its main macro, \SI, works in math mode as well as in text:


    For example, $x = \SI{1}{\giga\byte}$ or \SI{1}{\gibi\byte}.

See page 38 of the siunitx manual for further information.


From documentation: "In version 3, the document commands have been revised to be more descriptive. As such, the commands \SI, \SIlist, \SIrange and \si remain available but are not recommended for use in new documents. Use the new \qty... commands instead"


    For example, \qty{1}{\giga\byte}.
    For example, \qty{50}{\mega\byte}.
  • Welcome to TeX.SE! BTW, your MWE works (after correcting spelling error) also without siunitx option binary-units ... can you explain why?
    – Zarko
    Jul 23, 2022 at 4:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .