User Rating 0.0
Total Usage 0 times
Supports English words, digits, hyphens, and mixed expressions
Result
Examples:
Is this tool helpful?

Your feedback helps us improve.

About

Parsing English numeric expressions is deceptively complex. The phrase one million forty-five hundred ninety-two encodes a non-trivial additive-multiplicative structure where 45 hundred means 4500, not a syntax error. Most naive implementations fail on mixed inputs (words interleaved with digit characters), compound scales (twenty-three thousand four hundred), or informal constructs like nineteen ninety-nine. This converter implements a recursive descent parser that correctly handles the full English numeral grammar from 0 through trillions, including mixed-mode strings like one million 45 hundred 92. It returns NaN for genuinely unparseable input rather than guessing.

The parser follows the hierarchical scale model: tokens are grouped by magnitude (trillion > billion > million > thousand > hundred), with each group accumulated additively before multiplication by its scale factor. This tool approximates standard English numeral conventions. It does not handle ordinal forms (first, second) or fractional expressions (one half). Connector words like and are discarded as semantically empty.

words to numbers number converter text to number numeric words english number parser word number converter

Formulas

The parser decomposes English numeric text using an additive-multiplicative grammar. Each input phrase is segmented by scale words and accumulated hierarchically.

Result = s S groups × scales

Where S = {trillion, billion, million, thousand, unit} is the ordered set of scale magnitudes. Each groups is itself computed as:

group = h × 100 + t + u

Where h is the hundreds digit (0 - 9), t is the tens value (0 - 90), and u is the units value (0 - 9 or teens 10 - 19). Digit tokens (e.g. 45) are injected directly into the accumulator at the appropriate position. If any token is neither a recognized word nor a valid integer, the output is NaN.

Reference Data

English WordNumeric ValueCategory
zero0Unit
one1Unit
two2Unit
three3Unit
four4Unit
five5Unit
six6Unit
seven7Unit
eight8Unit
nine9Unit
ten10Teen
eleven11Teen
twelve12Teen
thirteen13Teen
fourteen14Teen
fifteen15Teen
sixteen16Teen
seventeen17Teen
eighteen18Teen
nineteen19Teen
twenty20Tens
thirty30Tens
forty40Tens
fifty50Tens
sixty60Tens
seventy70Tens
eighty80Tens
ninety90Tens
hundred100Scale
thousand1,000Scale
million1,000,000Scale
billion1,000,000,000Scale
trillion1,000,000,000,000Scale

Frequently Asked Questions

Digit tokens (e.g. 45, 92) are detected via regex and converted to their integer value before entering the same accumulation pipeline as word tokens. So "45 hundred" is parsed as group value 45 × 100 = 4500, then 92 is added as a unit, yielding 4592 within the millions group. The final result is 1,000,000 + 4,592 = 1,004,592.
Ambiguous or invalid input should fail explicitly. If the parser encounters an unrecognized token (e.g. "banana", "first", 'half'), it cannot determine intent. Returning NaN follows the IEEE 754 convention for undefined numeric operations and prevents silent errors in downstream calculations.
No. Ordinal forms (first, second, third, twenty-first, etc.) are not part of the cardinal numeral grammar this parser implements. Ordinals encode positional information, not pure quantity. Input containing ordinals will return NaN.
The parser supports values up to the trillions scale. The theoretical maximum is 999,999,999,999,999 (nine hundred ninety-nine trillion nine hundred ninety-nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine). JavaScript number precision (IEEE 754 double) is reliable up to 2^53 − 1 ≈ 9 × 10^15, so values within the trillions range are exact.
The word "and" is stripped during tokenization. In English numeric expressions, "and" is semantically empty - "one hundred and forty-two" and "one hundred forty-two" encode the same value (142). The parser discards "and" before processing.
Negative numbers are supported via the prefix words "negative" or "minus" (e.g. "negative forty-two" → −42). Decimal fractions expressed as words (e.g. 'three point one four') are not currently supported. The parser handles integers only. Digit-format decimals within mixed input (e.g. 'one hundred 3.5') will cause a NaN result.
Yes. The parser treats any value preceding "hundred" as a hundreds multiplier. So "forty-five hundred" computes as 45 × 100 = 4500. This matches colloquial English usage where "fifteen hundred" means 1500, not an error.