Best way I've found is to start out on hourly gigs, until you have a sense of how long certain tasks take you. With experience, you get better at estimating your time.
EDIT: Oh and when you start out, if you're estimating time, double it.
Also, start out on hourly gigs - and then always stay with hourly gigs (time & materials). If you fixed price work you end up having to piss off clients with anal scope management (or you take a bath).
EDIT: Oh and when you start out, if you're estimating time, double it.