Here’s a useful little chunk of code to put in your toolbox. I need to display file sizes to users, and I want to format the displayed file size as you’d see it in Explorer — 10.1 KB, 23.31 MB, and so on (not 112230103 bytes, for example). After a quick google search, I turned up a post on forums.asp.net that got me really close. I cleaned up a couple of issues and built a unit test to make sure things were working correctly, and it’s ready to go. Read on to see the working code.