gizmobench

Words to Number

Turn written English numbers into digits: "one million two hundred and thirty-four thousand" becomes 1,234,000. The exact inverse of the number-to-words tool, and tested by round-tripping against it rather than against a handful of examples.

Parsed1,234,567one million two hundred and thirty-four thousand five hundred and sixty-seven
Words

Or start from one of these:

  • Numberas a plain JavaScript number
    1234567

    A JavaScript number holds this value exactly, so this is the same number as the exact value below, written the way JavaScript writes it.

  • Formattedwith thousands separators
    1,234,567

    Separators only: every digit is the one in the row below it, in the same order.

  • Exact valueevery digit, at any size
    1234567

    Carried in BigInt from the first word to the last, so it is never rounded, however many digits it takes.

Tested by round trip, not by example. Every value in a wide range is spelled out by the number-to-words tool and read back here, in both American and British wording, and it has to land on itself. That catches whole classes of error a handful of hand-picked cases would miss.

Common questions

What number formats does it understand?
Units, teens, tens, hundreds and the scales up to trillion; hyphenated forms like twenty-one; "and" as in one hundred and five; ordinals such as twenty-first; negatives written as minus six; decimals as three point one four; and the article forms "a hundred" and "a thousand". Casing and extra whitespace are ignored.
How do you know the conversion is right?
By round trip. Every value across a wide range is converted to words by the number-to-words tool and parsed back here, and must land on itself. That catches whole classes of error (a missing scale, a misplaced "and", an ordinal handled inconsistently) that a set of hand-picked examples would sail past.
What happens with something it cannot parse?
It names the word it could not use and where in the phrase it appeared, rather than returning zero or a partial number. A silent partial answer is the dangerous failure here: "two hundred and fifty-elephant" returning 250 looks entirely plausible.
Does it handle British and American conventions?
Yes. British English tends to use "and" before the tens, as in one hundred and five, while American English often omits it. Both parse to the same value. The short-scale reading of billion and trillion is used, which is now standard in both.
Why does 'thousand thousand' get rejected?
Because it is not how English expresses a million, and accepting it would mean accepting a lot of malformed input that is more likely a typo than an intent. The tool explains the rejection and suggests the form that works, rather than guessing at a number nobody wrote.
Can I mix digits and words?
Yes. "2 thousand" is understood as 2000. It is a common way people actually write numbers in notes and transcripts, so refusing it would fail on real input rather than on edge cases.

Exact. The value is accumulated in arbitrary-precision integers rather than a floating-point number, so it stays correct at any size. Where a value is too large for a JavaScript number to hold, the exact digits are still shown and the tool says plainly that the ordinary numeric form has lost precision.