BitLength
BitLength[n] gives the number of binary bits necessary to represent the integer n.
Examples
Number of bits for small integers:
BitLength[7]
(* 3 *)BitLength[255]
(* 8 *)Please visit the official Wolfram Language Reference for more details.