Indented.net lets you automatically clean up your code with just a few clicks and some behind-the-scenes magic.
Indented.net is meant for C-like languages. It should work well with Java, PHP and the like, but don't expect the same results with, say, Pascal or Fortran.
Open Source
Indented.net is open source — you are welcome to see the code. (Update: be warned that it is rather old code which hasn't been touched in three or four years.)