Use Laravel's Number utility class to format numbers into localized currencies, percentages, and spelled-out words.
Formatting numbers for localized user interfaces traditionally required configuring PHP's NumberFormatter extension manually.
Laravel provides the Illuminate\Support\Number utility class.
Formatting Currencies
use Illuminate\Support\Number;
echo Number::currency(1500, in: 'USD');
// "$1,500.00"
echo Number::currency(2490.50, in: 'EUR', locale: 'de');
// "2.490,50 €"
echo Number::currency(50000, in: 'INR');
// "₹50,000.00"
Formatting Percentages and Compact Numbers
// Percentages
echo Number::percentage(0.854, precision: 1);
// "85.4%"
// Compact abbreviated numbers
echo Number::abbreviate(1250000);
// "1.3M"
echo Number::abbreviate(4500);
// "4.5K"
Spelling Out Numbers and Ordinals
echo Number::spell(42);
// "forty-two"
echo Number::ordinal(3);
// "3rd"
Summary
- Formats localized currency amounts with ISO 4217 codes.
- Abbreviates large numbers into human-readable notation (e.g.
1.2M,500K). - Spells out integer counts and ordinal positions for natural UI copy.
Related Tips
View all tips →Convert Variable Names and Slugs to Title Case with Str::headline()
Use Str::headline() to convert camelCase, snake_case, or kebab-case strings into clean, human-readable title headings.
Format Raw Bytes into Human-Readable File Sizes with Number::fileSize()
Use Number::fileSize() to convert raw byte integers into formatted KB, MB, GB, and TB strings with customizable precision.