Number Words to Digits Converter

Scans text for spelled-out English number words in the 0-999 range, including compounds like 'twenty three', 'forty-two', or 'one hundred and forty two', and replaces them with digit form, leaving all other words untouched. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Converting spelled-out numbers like 'forty two' into digit form ('42') is a common cleanup step when normalizing text for data processing.

This tool runs entirely client-side, so nothing you paste is ever uploaded to a server.

What Is Number Words to Digits Converter?

A converter that scans text for spelled-out English number words in the 0-999 range and replaces them with digit form, using a built-in word list.

It's part of this site's String Tools collection and works entirely in your browser, recognizing compounds like 'twenty three' and 'one hundred and forty two' as single numbers.

How Number Words to Digits Converter Works

The tool tokenizes the text into letter runs and non-letter runs, then scans for sequences of recognized number words (ones, tens, and 'hundred'), allowing a connecting 'and' or hyphen between them.

Each recognized sequence is converted to its numeric value and substituted in place; if the computed value falls outside 0-999, the original text is left unchanged as a safety fallback.

When To Use Number Words to Digits Converter

Use it to normalize text containing spelled-out numbers into digit form before further processing or analysis.

It's also useful for cleaning up transcripts, form responses, or documents where numbers were typed out as words.

Features

Advantages

  • Understands compound number phrases, not just single words.
  • Leaves all non-number text completely untouched.

Limitations

  • Only supports the 0-999 range; larger numbers like 'thousand' or 'million' are not recognized.
  • Relies on a fixed English word list, so it won't recognize numbers spelled out in other languages.

Examples

Converting a compound number phrase

Input

I have twenty three apples.

Output

I have 23 apples.

The compound phrase 'twenty three' is recognized as a single number word sequence and replaced with '23'.

Best Practices & Notes

Best Practices

  • Use standard English spelling and spacing for number words to get the most reliable matches.

Developer Notes

Tokenization uses `input.match(/[A-Za-z]+|[^A-Za-z]+/g)` to separate letter runs from everything else; a greedy scan collects consecutive number-word tokens (optionally joined by a connector matching `isConnector()`), computes their value via `wordsToValue()`, and substitutes the digit string only when the result is within 0-999.

Number Words to Digits Converter Use Cases

  • Normalizing spelled-out numbers in text before data processing
  • Cleaning up transcripts or form responses with written-out numbers
  • Converting a written amount into digit form for a spreadsheet

Common Mistakes

  • Expecting numbers above 999 (like 'one thousand') to convert; only the 0-999 range is supported.
  • Using non-English number words, which the built-in dictionary doesn't recognize.

Tips

  • Use the companion Digits to Number Words Converter to go the opposite direction, from digits back to spelled-out words.

References

Frequently Asked Questions