For information, I'm a freelance web developer. I write out on a piece or several pieces of paper all the steps I'm going to need to complete a project, which is essentially the same as breaking it down into smaller tasks as others have mentioned. This also means you can query potential problems before you start plus you have a guide for when you do start. The smaller tasks are then estimated based on previous experience or best guess. I then need to factor in things such as, deploying to a test environment (and setting this up), as well as deploying to live (again, setting this up or whatever is required), debugging and testing time, plus time to allow for unforeseen problems. You'll never be accurate all the time but you should be somewhere close.