FromDigits[list]
constructs an integer from the list of its decimal digits.
FromDigits[list,b]
takes the digits to be given in base b.
FromDigits[list,MixedRadix[blist]]
uses the mixed radix with list of bases blist.
FromDigits["string"]
constructs an integer from a string of digits.
FromDigits["string","Roman"]
constructs an integer from Roman numerals.
FromDigits
FromDigits[list]
constructs an integer from the list of its decimal digits.
FromDigits[list,b]
takes the digits to be given in base b.
FromDigits[list,MixedRadix[blist]]
uses the mixed radix with list of bases blist.
FromDigits["string"]
constructs an integer from a string of digits.
FromDigits["string","Roman"]
constructs an integer from Roman numerals.
Details
- FromDigits is effectively the inverse of IntegerDigits and IntegerString.
- FromDigits[{list,n},b] takes n to be an exponent, while FromDigits[{{a1,a2,…,{rep}},n},b] takes rep to be repeated, so that FromDigits can also be used as the inverse of RealDigits.
- Since IntegerDigits[n] discards the sign of n, FromDigits[IntegerDigits[n]] is Abs[n], not just n. »
- The digits in list and the base b need not be positive integers, and can be any expression. »
- If Indeterminate appears in list, it is assumed to signify unknown digits beyond the precision of an approximate real number. »
- FromDigits["string",b] takes the digits in "string" to be given in base b.
- In FromDigits["string",b], digits above 9 can be represented by letters a–z or A–Z.
Examples
open all close allBasic Examples (5)
Construct a number from its base-10 digits:
FromDigits[{5, 1, 2, 8}]FromDigits[{1, 0, 1, 1, 0, 1, 1}, 2]Construct a number from digits given as string:
FromDigits["1923"]Construct a number from digits base 2:
FromDigits["1011011", 2]Construct a number from digits in a mixed radix system:
FromDigits[{1, 4, 25, 41}, MixedRadix[{24, 60, 60}]]Scope (5)
Expand[FromDigits[{a, b, c, d, e}, x]]Digits larger than the base are "carried":
FromDigits[{7, 11, 0, 0, 0, 122}]Reconstruct a rational number from recurring digits:
RealDigits[11 / 7]FromDigits[%]Reconstruct a number from its digits in a mixed radix system:
FromDigits[{3, 2, 5}, MixedRadix[{3, 12}]]FromDigits["XVII", "Roman"]Generalizations & Extensions (1)
Applications (3)
Find the number with recurring digits 123:
FromDigits[{{{1, 2, 3}}, 0}]N[%, 30]Find numbers with successive recurring binary digit sequences:
FromDigits[{{#}, 0}, 2]& /@ Tuples[{0, 1}, 4]Find all integers with digits 1, 2 or 3:
Array[FromDigits[{##}]&, {3, 3, 3}]Properties & Relations (1)
Reconstruct a number of seconds from a list {days,hours,minutes,seconds}:
FromDigits[{1, 3, 22, 14}, MixedRadix[{24, 60, 60}]]It can also be obtained with NumberCompose:
NumberCompose[{1, 3, 22, 14}, {86400, 3600, 60, 1}]Perform the same computation using Quantity objects:
Quantity[MixedMagnitude[{1, 3, 22, 14}], MixedUnit[{"Days", "Hours", "Minutes", "Seconds"}]]UnitConvert[%, "Seconds"]Possible Issues (3)
IntegerDigits drops the sign:
FromDigits /@ IntegerDigits[Range[-10, 10]]Without a base specified, the characters are interpreted as extensions of base-10 digits:
FromDigits /@ {"7", "8", "9", "A", "B", "C", "D"}If no base is specified, the multicharacter strings are converted using base 10:
FromDigits["1A3C"]1 10^3 + 10 10^2 + 3 10 + 12Tech Notes
Related Guides
History
Introduced in 1996 (3.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2007 (6.0) ▪ 2015 (10.2)
Text
Wolfram Research (1996), FromDigits, Wolfram Language function, https://reference.wolfram.com/language/ref/FromDigits.html (updated 2015).
CMS
Wolfram Language. 1996. "FromDigits." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FromDigits.html.
APA
Wolfram Language. (1996). FromDigits. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FromDigits.html
BibTeX
@misc{reference.wolfram_2026_fromdigits, author="Wolfram Research", title="{FromDigits}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FromDigits.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_fromdigits, organization={Wolfram Research}, title={FromDigits}, year={2015}, url={https://reference.wolfram.com/language/ref/FromDigits.html}, note=[Accessed: 13-June-2026]}