Skip to content

Arabic Number to Words in JavaScript โ€‹

Convert numbers to Arabic words across 9 regional locales. Handles RTL text, dual (ู…ุซู†ู‰), 3-decimal currencies (Dinar, Rial), and Eastern Arabic numerals.

Locale codes: ar-AE, ar-DZ, ar-EG, ar-IQ, ar-LB, ar-MA, ar-SA, ar-SD, ar-YE ยท Numbering system: Short scale ยท Currency: Region-specific Arabic currencies ยท Script: Arabic (RTL)

LocaleCountryCurrency
ar-AEUAEDirham (ุฏุฑู‡ู…)
ar-DZAlgeriaDinar (ุฏูŠู†ุงุฑ)
ar-EGEgyptPound (ุฌู†ูŠู‡)
ar-IQIraqDinar (ุฏูŠู†ุงุฑ) โ€” 3 decimal
ar-LBLebanonPound (ู„ูŠุฑุฉ)
ar-MAMoroccoDirham (ุฏุฑู‡ู…)
ar-SASaudi ArabiaRiyal (ุฑูŠุงู„)
ar-SDSudanPound (ุฌู†ูŠู‡)
ar-YEYemenRial (ุฑูŠุงู„)

Install โ€‹

bash
npm install to-words

Basic Conversion โ€‹

js
import { ToWords } from 'to-words';

const tw = new ToWords({ localeCode: 'ar-SA' });

tw.convert(12345);
// "ุงุซู†ุง ุนุดุฑ ุฃู„ูุงู‹ ูˆุซู„ุงุซู…ุงุฆุฉ ูˆุฎู…ุณุฉ ูˆุฃุฑุจุนูˆู†"

tw.convert(1234.56, { currency: true });
// "ุฃู„ู ูˆู…ุฆุชุงู† ูˆุฃุฑุจุนุฉ ูˆุซู„ุงุซูˆู† ุฑูŠุงู„ุงู‹ ูˆุณุชุฉ ูˆุฎู…ุณูˆู† ู‡ู„ู„ุฉ"

Gender Support โ€‹

js
const tw = new ToWords({ localeCode: 'ar-AE' });

tw.convert(3, { gender: 'masculine' });
tw.convert(3, { gender: 'feminine' });
tw.convert(21, { gender: 'feminine' });

Arabic is one of the locale families where gender changes the actual numeral wording, so this matters for invoices, legal text, and voice output.

Iraq โ€” 3-decimal Dinar (IQD) โ€‹

js
const iq = new ToWords({ localeCode: 'ar-IQ' });
iq.convert('1.500', { currency: true });
// "ุฏูŠู†ุงุฑ ูˆุงุญุฏ ูˆุฎู…ุณู…ุงุฆุฉ ูู„ุณ"

Locale Codes โ€‹

Locale codeCountryCurrencyNotes
ar-AEUnited Arab EmiratesDirham / FilsArabic wording for UAE deployments
ar-DZAlgeriaDinarArabic wording for Algeria
ar-EGEgyptPoundArabic wording for Egypt
ar-IQIraqDinar / FilsBuilt-in 3-decimal currency handling
ar-LBLebanonPoundArabic wording for Lebanon
ar-MAMoroccoDirhamArabic wording for Morocco
ar-SASaudi ArabiaRiyal / HalalaStrong default for Gulf-region Arabic
ar-SDSudanPoundArabic wording for Sudan
ar-YEYemenRialArabic wording for Yemen

Tree-shakeable import โ€‹

js
import { toWords } from 'to-words/ar-SA';
toWords(1000); // "ุฃู„ู"

FAQ โ€‹

Q: What locale should I use for Saudi Arabia?
A: ar-SA.

Q: Does it handle right-to-left (RTL) output?
A: Yes, the output is naturally RTL Arabic text โ€” wrap it in a dir="rtl" container in HTML.

Q: Which Arabic locales support 3-decimal currencies?
A: ar-IQ (Iraqi Dinar) ships with 3-decimal precision in the current locale set.

Released under the MIT License.