Hidden Methods Beginner Since Laravel 11.x

Number::abbreviate()

Format large numbers into human-readable abbreviations like "1K", "2.5M", or "3B" with locale support.

Overview

Number::abbreviate() converts large numbers into short, human-friendly strings. It handles thousands (K), millions (M), billions (B), and trillions (T) automatically with configurable precision.

Usage

use Illuminate\Support\Number;

Number::abbreviate(1000);
// '1K'

Number::abbreviate(489939);
// '490K'

Number::abbreviate(1_230_000, precision: 2);
// '1.23M'

Number::abbreviate(1_500_000_000);
// '2B'

You can also use the other Number formatting helpers:

Number::format(1234567.89);
// '1,234,567.89'

Number::percentage(75.5, precision: 1);
// '75.5%'

Number::currency(1500, 'USD');
// '$1,500.00'

Number::fileSize(1073741824);
// '1 GB'

Number::forHumans(1_000_000);
// '1 million'

When to Use

  • Dashboards displaying follower counts, view counts, or revenue
  • Social media-style number formatting (e.g., "12.3K likes")
  • Any UI where screen real estate is limited and exact numbers aren't needed