IntegerLength
IntegerLength[n] gives the number of digits in the base 10 representation of n.
IntegerLength[n, b] gives the number of digits in base b.
Examples
Decimal digits:
IntegerLength[12345]
(* 5 *)Binary digits:
IntegerLength[255, 2]
(* 8 *)Please visit the official Wolfram Language Reference for more details.