Numbers to Words Converter
Numbers to Words Converter is evaluated from Number to Convert. The calculation reports Number in Words, Check Writing Format and Ordinal Form.
Results
About the Numbers to Words Converter
The calculator uses a multi formula configuration. Each reported value is read as a direct evaluation of the stored rules with the declared field formats and units.
Formula basis:
_n = Math.trunc(parseFloat(number))
_ones = ['','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
_tens = ['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']
_below100 = (n) => n < 20 ? _ones[n]: _tens[Math.floor(n/10)] + (n%10 ? '-' + _ones[n%10]: '')
_below1000 = (n) => n < 100 ? _below100(n): _ones[Math.floor(n/100)] + ' hundred' + (n%100 ? ' ' + _below100(n%100): '')
_toWords = (n) => { if (n === 0) return 'zero'; var neg = n < 0; n = Math.abs(n); var parts = []; if (n >= 1000000000000) { parts.push(_below1000(Math.floor(n/1000000000000)) + ' trillion'); n = n% 1000000000000; } if (n >= 1000000000) { parts.push(_below1000(Math.floor(n/1000000000)) + ' billion'); n = n% 1000000000; } if (n >= 1000000) { parts.push(_below1000(Math.floor(n/1000000)) + ' million'); n = n% 1000000; } if (n >= 1000) { parts.push(_below1000(Math.floor(n/1000)) + ' thousand'); n = n% 1000; } if (n > 0) parts.push(_below1000(n)); return (neg ? 'negative ': '') + parts.join(' '); }
words = _toWords(_n)
check_format = _toWords(Math.abs(_n)).charAt(0).toUpperCase() + _toWords(Math.abs(_n)).slice(1) + ' and 00/100 dollars'
_mod100 = Math.abs(_n)% 100
_mod10 = Math.abs(_n)% 10
_ordSuffix = (_mod100 >= 11 && _mod100 <= 13) ? 'th': (_mod10 === 1 ? 'st': _mod10 === 2 ? 'nd': _mod10 === 3 ? 'rd': 'th')
ordinal = _toWords(_n) + _ordSuffix
digit_count = Math.abs(_n).toString().length
Interpret the outputs in the order shown by the result fields. Optional inputs affect only the outputs that depend on those variables.
Formula & How It Works
The calculation applies the following relations exactly as recorded in the metadata:
_n = Math.trunc(parseFloat(number))
_ones = ['','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
_tens = ['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']
_below100 = (n) => n < 20 ? _ones[n]: _tens[Math.floor(n/10)] + (n%10 ? '-' + _ones[n%10]: '')
_below1000 = (n) => n < 100 ? _below100(n): _ones[Math.floor(n/100)] + ' hundred' + (n%100 ? ' ' + _below100(n%100): '')
_toWords = (n) => { if (n === 0) return 'zero'; var neg = n < 0; n = Math.abs(n); var parts = []; if (n >= 1000000000000) { parts.push(_below1000(Math.floor(n/1000000000000)) + ' trillion'); n = n% 1000000000000; } if (n >= 1000000000) { parts.push(_below1000(Math.floor(n/1000000000)) + ' billion'); n = n% 1000000000; } if (n >= 1000000) { parts.push(_below1000(Math.floor(n/1000000)) + ' million'); n = n% 1000000; } if (n >= 1000) { parts.push(_below1000(Math.floor(n/1000)) + ' thousand'); n = n% 1000; } if (n > 0) parts.push(_below1000(n)); return (neg ? 'negative ': '') + parts.join(' '); }
words = _toWords(_n)
check_format = _toWords(Math.abs(_n)).charAt(0).toUpperCase() + _toWords(Math.abs(_n)).slice(1) + ' and 00/100 dollars'
_mod100 = Math.abs(_n)% 100
_mod10 = Math.abs(_n)% 10
_ordSuffix = (_mod100 >= 11 && _mod100 <= 13) ? 'th': (_mod10 === 1 ? 'st': _mod10 === 2 ? 'nd': _mod10 === 3 ? 'rd': 'th')
ordinal = _toWords(_n) + _ordSuffix
digit_count = Math.abs(_n).toString().length
Each output field is produced by substituting the supplied inputs into the relevant relation and then applying the declared rounding or text format.
Worked Examples
Example 1: Writing a check for $1,547.00
Inputs
With Number to Convert = 1,547 as the stated inputs, the result is Check Writing Format = and 00/100 dollars, Ordinal Form = th and Number of Digits = 4. Each value corresponds to the declared output fields.
Example 2: US national debt ~ $33 trillion
Inputs
With Number to Convert = 33,000,000,000,000 as the stated inputs, the result is Check Writing Format = and 00/100 dollars, Ordinal Form = th and Number of Digits = 14. Each value corresponds to the declared output fields.
Example 3: Pi approximation 3141592653
Inputs
With Number to Convert = 3,141,592,653 as the stated inputs, the result is Check Writing Format = and 00/100 dollars, Ordinal Form = rd and Number of Digits = 10. Each value corresponds to the declared output fields.
Example 4: Negative number: -42
Inputs
With Number to Convert = -42 as the stated inputs, the result is Number in Words = negative, Check Writing Format = and 00/100 dollars and Ordinal Form = negative nd. Each value corresponds to the declared output fields.
Common Use Cases
- Write check amounts in words
- Spell out dollar amounts for legal documents
- Convert numbers to words for educational purposes