MAD

Moroccan Dirham

MAD

Primary country: Morocco

Symbol

MAD

Decimal Places

2

ISO Numeric

504

Formatting Example

MAD 1,234.56

Usage in Code

// JavaScript Intl.NumberFormat
new Intl.NumberFormat('en', {
  style: 'currency',
  currency: 'MAD'
}).format(1234.56)
// → "MAD 1,234.56"

// ISO 4217 code: MAD
// Numeric code: 504
// Minor unit: 2 decimal places

About Moroccan Dirham

The Moroccan Dirham (MAD) is the official currency of Morocco, identified by the ISO 4217 code "MAD" and numeric code 504. Its symbol is MAD, and amounts are typically formatted with 2 decimal places (e.g., MAD 1,234.56).

In software development, currency codes are essential for e-commerce, financial applications, and internationalization. The JavaScript Intl.NumberFormat API supports formatting amounts in MAD with locale-aware separators and symbols. Payment processors like Stripe and PayPal require ISO 4217 currency codes when processing transactions.

When building multi-currency applications, store amounts in the smallest unit (e.g., cents for MAD) to avoid floating-point precision errors. Use the decimal places value (2) to correctly convert between major and minor units. APIs like exchangeratesapi.io and Open Exchange Rates provide real-time conversion rates for MAD.

Related Currencies