To calculate your hourly rate, first add your yearly salary to your expenses. This is the amount of money you need to make in a year to maintain your desired lifestyle. Then, divide this by your billable hours (not your total hours worked). The result is your hourly rate.
As an example, lets say you wanted to make $50,000 a year and you have $10,000 in expenses, both of which include adjustments for working as a freelancer. Lets also say you work a full 40-hour week, but only 25 of those hours are billable. That would leave you with 1,300 billable hours a year. Divide 1,300 into 60,000 (salary plus expenses) and your hourly rate would be approximately $46. You would probably adjust that to $45 or $50 to keep things simple.

