Depends on how you define "clean" ?

Well people think that "clean" HTML codes are the ones which pass through a validation test.

Code as you normally do and then just use this tool to check all your errors and fix them

But if you think "clean" codes means "codes written with proper alignment & indentation" then use this tool http://tools.arantius.com/tabifier as what 100c53jm suggested.