Here you go, another JavaScript approach, originally posted on [SO][1]: function getRepString (rep) { rep = rep+''; // coerce to string if (rep < 1000) { return rep; // return the same number } else if (rep < 10000) { // place a comma between return rep.charAt(0) + ',' + rep.substring(1); } else { // divide and format return (rep/1000).toFixed(rep % 1000 != 0)+'k'; } } Check the output results [here][2]. [1]: http://stackoverflow.com/questions/3177855/how-to-format-numbers-similar-to-stack-overflow-reputation-format/3177985#3177985 [2]: http://jsbin.com/ivebo3/2