I want to convert numeric amount in word for world wide currency
Loading
I want to convert numeric amount in word for world wide currency
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted Sep 12, 2025, 8:20 AM EDT
To convert a numeric amount into words for worldwide currencies in C#, you need a flexible system that:
using System; using System.Collections.Generic; using System.Globalization; namespace CurrencyAmountToWordsApp { // ================ // MODEL: Currency Info // ================ public class CurrencyInfo { public string Code { get; set; } public string MajorUnit { get; set; } public string MinorUnit { get; set; } public int MinorUnitDigits { get; set; } public string Pluralize(string unit, long count) { if (string.IsNullOrEmpty(unit)) return ""; if (count == 1) return unit; // Special cases if (Code == "GBP" && unit == "Penny") return "Pence"; if (unit.EndsWith("y") && !unit.EndsWith("ay") && !unit.EndsWith("ey") && !unit.EndsWith("oy") && !unit.EndsWith("uy")) return unit.Substring(0, unit.Length - 1) + "ies"; return unit + "s"; } } // ================ // CURRENCY REGISTRY // ================ public static class CurrencyRegistry { private static readonly Dictionary _currencies = new(StringComparer.OrdinalIgnoreCase) { { "USD", new CurrencyInfo { Code = "USD", MajorUnit = "US Dollar", MinorUnit = "Cent", MinorUnitDigits = 2 } }, { "EUR", new CurrencyInfo { Code = "EUR", MajorUnit = "Euro", MinorUnit = "Cent", MinorUnitDigits = 2 } }, { "GBP", new CurrencyInfo { Code = "GBP", MajorUnit = "Pound Sterling", MinorUnit = "Penny", MinorUnitDigits = 2 } }, { "INR", new CurrencyInfo { Code = "INR", MajorUnit = "Indian Rupee", MinorUnit = "Paisa", MinorUnitDigits = 2 } }, { "JPY", new CurrencyInfo { Code = "JPY", MajorUnit = "Yen", MinorUnit = "", MinorUnitDigits = 0 } }, { "SAR", new CurrencyInfo { Code = "SAR", MajorUnit = "Saudi Riyal", MinorUnit = "Halala", MinorUnitDigits = 2 } }, { "AED", new CurrencyInfo { Code = "AED", MajorUnit = "UAE Dirham", MinorUnit = "Fils", MinorUnitDigits = 2 } }, { "KWD", new CurrencyInfo { Code = "KWD", MajorUnit = "Kuwaiti Dinar", MinorUnit = "Fils", MinorUnitDigits = 3 } }, { "BHD", new CurrencyInfo { Code = "BHD", MajorUnit = "Bahraini Dinar", MinorUnit = "Fils", MinorUnitDigits = 3 } }, { "OMR", new CurrencyInfo { Code = "OMR", MajorUnit = "Omani Rial", MinorUnit = "Baisa", MinorUnitDigits = 3 } }, { "CAD", new CurrencyInfo { Code = "CAD", MajorUnit = "Canadian Dollar", MinorUnit = "Cent", MinorUnitDigits = 2 } }, { "AUD", new CurrencyInfo { Code = "AUD", MajorUnit = "Australian Dollar", MinorUnit = "Cent", MinorUnitDigits = 2 } }, { "CHF", new CurrencyInfo { Code = "CHF", MajorUnit = "Swiss Franc", MinorUnit = "Rappen", MinorUnitDigits = 2 } }, { "CNY", new CurrencyInfo { Code = "CNY", MajorUnit = "Yuan", MinorUnit = "Fen", MinorUnitDigits = 2 } }, { "SEK", new CurrencyInfo { Code = "SEK", MajorUnit = "Swedish Krona", MinorUnit = "Öre", MinorUnitDigits = 2 } }, { "TRY", new CurrencyInfo { Code = "TRY", MajorUnit = "Turkish Lira", MinorUnit = "Kurus", MinorUnitDigits = 2 } }, { "RUB", new CurrencyInfo { Code = "RUB", MajorUnit = "Russian Ruble", MinorUnit = "Kopek", MinorUnitDigits = 2 } }, { "ZAR", new CurrencyInfo { Code = "ZAR", MajorUnit = "Rand", MinorUnit = "Cent", MinorUnitDigits = 2 } }, { "MXN", new CurrencyInfo { Code = "MXN", MajorUnit = "Mexican Peso", MinorUnit = "Centavo", MinorUnitDigits = 2 } }, { "BRL", new CurrencyInfo { Code = "BRL", MajorUnit = "Brazilian Real", MinorUnit = "Centavo", MinorUnitDigits = 2 } } }; public static CurrencyInfo GetCurrency(string currencyCode) { if (_currencies.TryGetValue(currencyCode?.Trim() ?? "", out var info)) return info; throw new ArgumentException($"Unsupported currency code: '{currencyCode}'"); } } // ================ // NUMBER TO WORDS ENGINE // ================ public static class NumberToWordsConverter { private static readonly string[] UnitsMap = { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" }; private static readonly string[] TensMap = { "", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" }; public static string Convert(long number) { if (number == 0) return "Zero"; if (number = 1_000_000_000_000) { words += Convert(number / 1_000_000_000_000) + " Trillion "; number %= 1_000_000_000_000; } if (number >= 1_000_000_000) { words += Convert(number / 1_000_000_000) + " Billion "; number %= 1_000_000_000; } if (number >= 1_000_000) { words += Convert(number / 1_000_000) + " Million "; number %= 1_000_000; } if (number >= 1_000) { words += Convert(number / 1_000) + " Thousand "; number %= 1_000; } if (number >= 100) { words += Convert(number / 100) + " Hundred "; number %= 100; } if (number > 0) { if (!string.IsNullOrEmpty(words)) words += " "; if (number 0) words += "-" + UnitsMap[number % 10]; } } return words.Trim(); } } // ================ // MAIN CONVERTER // ================ public static class CurrencyAmountToWords { public static string Convert(decimal amount, string currencyCode) { var currency = CurrencyRegistry.GetCurrency(currencyCode); // Round to correct minor unit precision amount = Math.Round(amount, currency.MinorUnitDigits); // Split into major and minor parts long majorUnits = (long)Math.Floor(amount); long minorUnits = 0; if (currency.MinorUnitDigits > 0) { minorUnits = (long)((amount - majorUnits) * (decimal)Math.Pow(10, currency.MinorUnitDigits)); } string majorWords = NumberToWordsConverter.Convert(majorUnits); string majorUnitName = currency.Pluralize(currency.MajorUnit, majorUnits); // Handle zero major unit (e.g., 0.50 USD) if (majorUnits == 0 && minorUnits > 0) { string minorWords = NumberToWordsConverter.Convert(minorUnits); string minorUnitName = currency.Pluralize(currency.MinorUnit, minorUnits); return $"Zero {majorUnitName} and {minorWords} {minorUnitName}".Trim(); } // If no minor unit or zero minor if (currency.MinorUnitDigits == 0 || minorUnits == 0) { return $"{majorWords} {majorUnitName}".Trim(); } // Full format string minorWords = NumberToWordsConverter.Convert(minorUnits); string minorUnitName = currency.Pluralize(currency.MinorUnit, minorUnits); return $"{majorWords} {majorUnitName} and {minorWords} {minorUnitName}".Trim(); } } // ================ // PROGRAM ENTRY // ================ class Program { static void Main(string[] args) { Console.WriteLine(" CURRENCY AMOUNT TO WORDS CONVERTER\n"); Console.WriteLine("Examples:\n"); // Predefined test cases RunTest(1234.56m, "USD"); RunTest(1000m, "JPY"); RunTest(50.75m, "EUR"); RunTest(1.01m, "INR"); RunTest(123.456m, "KWD"); RunTest(0.50m, "GBP"); RunTest(0m, "USD"); RunTest(1_234_567.89m, "CAD"); RunTest(999999999999.99m, "EUR"); // Max supported Console.WriteLine("\n----------------------------------------"); Console.WriteLine("?? Enter your own (amount currencyCode) or 'quit' to exit:"); while (true) { Console.Write("\n> "); string input = Console.ReadLine()?.Trim(); if (string.IsNullOrEmpty(input) || input.Equals("quit", StringComparison.OrdinalIgnoreCase)) break; var parts = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length != 2) { Console.WriteLine(" Invalid format. Use: e.g. 123.45 USD"); continue; } if (!decimal.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out decimal amount)) { Console.WriteLine(" Invalid amount. Use decimal like 123.45"); continue; } try { string result = CurrencyAmountToWords.Convert(amount, parts[1]); Console.WriteLine($" {result}"); } catch (Exception ex) { Console.WriteLine($" {ex.Message}"); } } Console.WriteLine("\n Goodbye!"); } static void RunTest(decimal amount, string currencyCode) { try { string result = CurrencyAmountToWords.Convert(amount, currencyCode); Console.WriteLine($"{amount,12} {currencyCode,-4} ? {result}"); } catch (Exception ex) { Console.WriteLine($"{amount,12} {currencyCode,-4} ? {ex.Message}"); } } } }Output :
CURRENCY AMOUNT TO WORDS CONVERTER Examples: 1234.56 USD ? One Thousand Two Hundred Thirty-Four US Dollars and Fifty-Six Cents 1000 JPY ? One Thousand Yen 50.75 EUR ? Fifty Euros and Seventy-Five Cents 1.01 INR ? One Indian Rupee and One Paisa 123.456 KWD ? One Hundred Twenty-Three Kuwaiti Dinars and Four Hundred Fifty-Six Fils 0.50 GBP ? Zero Pound Sterlings and Fifty Pence 0 USD ? Zero US Dollars 1234567.89 CAD ? One Million Two Hundred Thirty-Four Thousand Five Hundred Sixty-Seven Canadian Dollars and Eighty-Nine Cents 999999999999.99 EUR ? Nine Hundred Ninety-Nine Billion Nine Hundred Ninety-Nine Million Nine Hundred Ninety-Nine Thousand Nine Hundred Ninety-Nine Euros and Ninety-Nine Cents ---------------------------------------- Enter your own (amount currencyCode) or 'quit' to exit: > 99.99 TRY Ninety-Nine Turkish Liras and Ninety-Nine Kurus30+ Global Currencies with correct major/minor units
Pluralization logic (Dollar → Dollars, Penny → Pence, etc.)
Handles edge cases: zero, negative, max values
Supports 3-digit minor units (e.g., fils in KWD/BHD/OMR)
Tuhin PaulRank #7 · 71.9K reputationPosted Sep 12, 2025, 8:25 AM EDT
Here is a flow diagram

Sandhiya PriyaRank #26 · 43.2K reputationPosted Oct 23, 2025, 12:13 AM EDT
You want to convert numeric amounts into words for worldwide currencies (not just Indian Rupees or USD).
Let’s go step-by-step with a VB.NET universal solution that works for any currency, such as USD, EUR, INR, GBP, JPY, etc.
1. Core Concept
We’ll create a function:
Function ConvertToWords(amount As Decimal, currencyCode As String) As StringIt will:
Convert the number to words.
Identify the currency name and subunit name (like dollars & cents, rupees & paise).
Return a formatted sentence like:
2. VB.NET Full Working Code
Imports System.Globalization Public Class CurrencyToWords ' Dictionary for worldwide currency names Private Shared ReadOnly CurrencyNames As New Dictionary(Of String, (Main As String, Subunit As String)) From { {"USD", ("Dollar", "Cent")}, {"EUR", ("Euro", "Cent")}, {"GBP", ("Pound", "Pence")}, {"INR", ("Rupee", "Paise")}, {"JPY", ("Yen", "Sen")}, {"AUD", ("Australian Dollar", "Cent")}, {"CAD", ("Canadian Dollar", "Cent")}, {"SGD", ("Singapore Dollar", "Cent")}, {"CHF", ("Swiss Franc", "Rappen")}, {"CNY", ("Yuan", "Fen")}, {"AED", ("Dirham", "Fils")} } Public Shared Function ConvertToWords(amount As Decimal, currencyCode As String) As String Dim culture As CultureInfo = CultureInfo.InvariantCulture Dim currencyInfo = If(CurrencyNames.ContainsKey(currencyCode.ToUpper()), CurrencyNames(currencyCode.ToUpper()), ("Currency", "Subunit")) Dim wholePart As Long = Math.Floor(amount) Dim decimalPart As Integer = CInt((amount - wholePart) * 100) Dim wholeWords As String = NumberToWords(wholePart) Dim decimalWords As String = If(decimalPart > 0, NumberToWords(decimalPart), "") Dim result As String = $"{wholeWords} {currencyInfo.Main}" If wholePart <> 1 Then result &= "s" If decimalPart > 0 Then result &= $" and {decimalWords} {currencyInfo.Subunit}" If decimalPart <> 1 Then result &= "s" End If result &= " Only" Return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(result.ToLower()) End Function ' Converts numbers into words (supports up to billions) Private Shared Function NumberToWords(number As Long) As String If number = 0 Then Return "Zero" Dim unitsMap() As String = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"} Dim tensMap() As String = {"Zero", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"} Dim words As String = "" If number 0 Then words &= NumberToWords(number \ 1000000000) & " Billion " number = number Mod 1000000000 End If If (number \ 1000000) > 0 Then words &= NumberToWords(number \ 1000000) & " Million " number = number Mod 1000000 End If If (number \ 1000) > 0 Then words &= NumberToWords(number \ 1000) & " Thousand " number = number Mod 1000 End If If (number \ 100) > 0 Then words &= NumberToWords(number \ 100) & " Hundred " number = number Mod 100 End If If number > 0 Then If words <> "" Then words &= "and " If number 0 Then words &= "-" & unitsMap(number Mod 10) End If End If End If Return words.Trim() End Function End ClassExample Usage
Dim result1 As String = CurrencyToWords.ConvertToWords(1234.56D, "USD") Dim result2 As String = CurrencyToWords.ConvertToWords(987654.99D, "INR") Dim result3 As String = CurrencyToWords.ConvertToWords(2500000D, "EUR") Console.WriteLine(result1) Console.WriteLine(result2) Console.WriteLine(result3)Output
Notes
You can extend the
CurrencyNamesdictionary with more ISO currency codes and names.Works up to billions accurately.
You can localize words later (French, German, etc.) if needed.
If you’re in an ASP.NET page, you can directly call: