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)
| Locale | Country | Currency |
|---|---|---|
ar-AE | UAE | Dirham (ุฏุฑูู ) |
ar-DZ | Algeria | Dinar (ุฏููุงุฑ) |
ar-EG | Egypt | Pound (ุฌููู) |
ar-IQ | Iraq | Dinar (ุฏููุงุฑ) โ 3 decimal |
ar-LB | Lebanon | Pound (ููุฑุฉ) |
ar-MA | Morocco | Dirham (ุฏุฑูู ) |
ar-SA | Saudi Arabia | Riyal (ุฑูุงู) |
ar-SD | Sudan | Pound (ุฌููู) |
ar-YE | Yemen | Rial (ุฑูุงู) |
Install โ
npm install to-wordsBasic Conversion โ
import { ToWords } from 'to-words';
const tw = new ToWords({ localeCode: 'ar-SA' });
tw.convert(12345);
// "ุงุซูุง ุนุดุฑ ุฃููุงู ูุซูุงุซู
ุงุฆุฉ ูุฎู
ุณุฉ ูุฃุฑุจุนูู"
tw.convert(1234.56, { currency: true });
// "ุฃูู ูู
ุฆุชุงู ูุฃุฑุจุนุฉ ูุซูุงุซูู ุฑูุงูุงู ูุณุชุฉ ูุฎู
ุณูู ูููุฉ"Gender Support โ
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) โ
const iq = new ToWords({ localeCode: 'ar-IQ' });
iq.convert('1.500', { currency: true });
// "ุฏููุงุฑ ูุงุญุฏ ูุฎู
ุณู
ุงุฆุฉ ููุณ"Locale Codes โ
| Locale code | Country | Currency | Notes |
|---|---|---|---|
ar-AE | United Arab Emirates | Dirham / Fils | Arabic wording for UAE deployments |
ar-DZ | Algeria | Dinar | Arabic wording for Algeria |
ar-EG | Egypt | Pound | Arabic wording for Egypt |
ar-IQ | Iraq | Dinar / Fils | Built-in 3-decimal currency handling |
ar-LB | Lebanon | Pound | Arabic wording for Lebanon |
ar-MA | Morocco | Dirham | Arabic wording for Morocco |
ar-SA | Saudi Arabia | Riyal / Halala | Strong default for Gulf-region Arabic |
ar-SD | Sudan | Pound | Arabic wording for Sudan |
ar-YE | Yemen | Rial | Arabic wording for Yemen |
Tree-shakeable import โ
import { toWords } from 'to-words/ar-SA';
toWords(1000); // "ุฃูู"Related โ
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.