How to Format Compact Numbers with the JavaScript
5 (635) In stock
![](https://www.freecodecamp.org/news/content/images/size/w2000/2023/01/Format-Compact-Numbers.png)
Sometimes it can be difficult to fit large numbers into your site or app's layout, especially if you have to display several of them together. As a result, a lot of modern sites and apps use the same format to display large numbers in a compact way. For example,
Sometimes it can be difficult to fit large numbers into your site or app's
layout, especially if you have to display several of them together.
As a result, a lot of modern sites and apps use the same format to display large
numbers in a compact way. For example, displaying 123,000 as 123K.
freeCodeCamp's and Instagram profiles using compact number format.You
can do this by writing a custom format function, using a third-party library,
or, best of all, using a built-in JavaScript API.
![](https://i.stack.imgur.com/nkmZ3.png)
javascript - How to format numbers as currency strings - Stack Overflow
![](https://i.stack.imgur.com/rz9ot.png)
google apps script - ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol - Stack Overflow
![](https://www.freecodecamp.org/news/content/images/size/w2000/2022/09/learn-eleventy.png)
Gerard Hynes
![](https://delicious-insights.com/assets/images/art-vid/js-nugget-3-currency-formatting-fr.png)
Properly formating a number • Delicious Insights
freeCodeCamp on LinkedIn: How to Format Compact Numbers with the
![](https://www.amitmerchant.com/cdn/compact-number-javascript.png)
Convert long numbers to short and compact form in JavaScript — Amit Merchant — A blog on PHP, JavaScript, and more
![](https://venngage-wordpress.s3.amazonaws.com/uploads/2021/03/Number-infographic-blog-header.png)
17 Number Infographics for Business Data - Venngage
freeCodeCamp on LinkedIn: How to Format Compact Numbers with the
freeCodeCamp di LinkedIn: How to Format Compact Numbers with the
![](https://blog.logrocket.com/wp-content/uploads/2022/06/complete-guide-toLocaleString-node-js.png)
The complete guide to toLocaleString in Node.js - LogRocket Blog
javascript - Format a number as 2.5K if a thousand or more
![](https://cdn-media-1.freecodecamp.org/images/1*oNjw5BDpdjHzMGKwIyWmQA.jpeg)
Internationalization
![](https://uploads.sitepoint.com/wp-content/uploads/2021/03/1615778552I18n-civ.jpg)
What is the JavaScript Internationalization API (I18n)? — SitePoint
Pants Size Conversion Chart Trendy sewing patterns, Sewing
Number Size Comparison XD part 1 - Comic Studio
Very small and very big numbers in nature - comparing size of