Number to Words Conversion — When, Why, and How to Implement It
Number to words conversion translates numeric values into their full written English equivalents — 1234 becomes "one thousand two hundred thirty-four" and 5250.00 becomes "five thousand two hundred fifty dollars." This is a standard requirement in financial documents, legal contracts, invoice generation, accessibility features, and internationalisation work. Despite its apparent simplicity, edge cases like hundreds vs thousands, the word "and," currency formatting, and very large numbers make this a surprisingly nuanced problem to implement correctly.
Convert any number to words instantly with our free Number to Words Converter tool. For other text and data formatting tools, see our Text Size Calculator and Character Counter.
Where Number to Words Conversion Is Required
Financial Documents
Cheques, bank drafts, and money orders require amounts written in words as a fraud prevention measure. The written form is harder to alter than digits — changing "five thousand" is more obviously suspicious than changing "5,000" to "9,000." Legal financial documents like deeds and settlement agreements also routinely write numerical amounts in words, often with the numeral in parentheses after: "five thousand two hundred and fifty dollars ($5,250.00)."
Invoice Generation
Many accounting and invoicing systems automatically generate the written word form of invoice totals for formal documentation. In some jurisdictions and industries this is legally required. Invoice software built on platforms that handle billing needs this conversion as a standard feature.
Legal Documents
Contracts, property deeds, and legal agreements write numbers in words to eliminate ambiguity. Photocopied or scanned documents can have digits altered more easily than written words. Courts and legal professionals often require number words alongside numerals for clarity and tamper-evidence purposes.
Accessibility
Screen readers handle written numbers differently from numerals. The number 1,000,000 might be read aloud as "one comma zero zero zero comma zero zero zero" by some screen readers, while the words "one million" are unambiguous. Content targeting users with visual impairments benefits from either written number words or structured markup that helps screen readers interpret numbers correctly. Our Text to Speech tool can help you test how text reads aloud.
Internationalisation
Different languages and regions write numbers differently. Not just the words themselves, but the grouping conventions (comma vs period as thousands separator), the position of currency symbols, and the spoken-word equivalents all vary by locale. Applications serving international audiences need locale-aware number formatting.
The Edge Cases That Trip Developers Up
Writing a number-to-words converter from scratch is deceptively difficult due to the edge cases:
The word "and": British English conventionally includes "and" before the final component — "one hundred and twenty-three." American English often omits it — "one hundred twenty-three." Your implementation needs to match the convention expected by your audience.
Hundreds vs thousands: 1100 could be "one thousand one hundred" or "eleven hundred." Both are correct; context and preference determine which to use. Financial documents typically prefer the full thousands form.
Zero: "zero" as a standalone, but "oh" in phone numbers, "O" in some British contexts, and typically omitted in many positions within larger numbers. The word form of 1001 is "one thousand and one" not "one thousand zero one."
Negative numbers: require "negative" or "minus" prefix depending on context. Decimals: typically read digit by digit after the decimal point — 3.14 becomes "three point one four" for general use, or "three and fourteen hundredths" in formal contexts. Very large numbers: require knowing whether to use short scale (billion = 10 to the 9th power, the US/UK standard) or long scale (milliard = 10 to the 9th power, used in much of continental Europe).
Convert any number to words — perfect for invoices, legal documents, and cheques
Try Number to Words Converter Free →Implementing Number to Words in Code
Python — num2words Library
The most widely used Python library for this: from num2words import num2words num2words(1234) returns "one thousand, two hundred and thirty-four" num2words(1234, lang="de") returns the German equivalent num2words(42.5) returns "forty-two point five" num2words(1234.56, to="currency", lang="en_GB") returns currency word form num2words supports over 30 languages and handles ordinal numbers as well as cardinal.
JavaScript
No built-in function exists for number to words in JavaScript. The Intl.NumberFormat API provides locale-aware numeric formatting (with separators and currency symbols) but not word forms. Use a library like written-number or number-to-words from npm, or implement a custom function for your specific requirements.
PHP
PHP also lacks a built-in function. The NumberFormatter class with SPELLOUT style handles number-to-words in the available locale: $formatter = new NumberFormatter("en", NumberFormatter::SPELLOUT); echo $formatter->format(1234); // "one thousand two hundred thirty-four" This uses the system ICU library and supports multiple locales.
Currency Format Implementation
For financial documents, the typical pattern is to split the amount at the decimal point, convert both parts separately, then format: Amount 5250.75: Integer part (5250) = "five thousand two hundred fifty" Decimal part (75) = "seventy-five" Result: "five thousand two hundred fifty dollars and seventy-five cents"

