 <p>Here's another approach which accounts for cents:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Money Conversion&lt;/title&gt; &lt;script type="text/javascript"&gt; function numberToCurrency(amount) { var wholeDigits; var thousandsSeparator = "," var centSeparator = "." var currencyNum = ""; if(amount.indexOf(".") != -1) { var hasCents = true; } else { var hasCents = false; } if (hasCents == true) { var num = amount.split("."); var wholeDigits = num[0].split(""); var centAmount = num[1]; var centDigits = num[1].split(""); if (centDigits.length == 0) { centDigits += "00"; } if ((centDigits.length &gt; 0) &amp;&amp; (centDigits.length &lt; 2)) { centDigits += "0"; } } else { centDigits = ""; centSeparator = ""; wholeDigits = amount.split(""); } var countDigits = wholeDigits.length; var revDigits = wholeDigits.reverse(); for(var i=0; i&lt;countDigits; i++) { if ((i%3 == 0) &amp;&amp; (i !=0)) { currencyNum += thousandsSeparator+revDigits[i]; } else { currencyNum += wholeDigits[i]; } }; var revCurrency = currencyNum.split("").reverse().join(""); var finalCurrency = "$"+revCurrency+centSeparator+centAmount; return finalCurrency; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; document.write(numberToCurrency('12326563523.37')); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It does the trick, though it doesn't round the cent amounts or strip off extras past 2 digits.</p>