I've worked as an engineering consultant for 10 years. Here's the best algorithm I've come up with.<p>1. Guess how many hours you think the project will take to complete. (This is hard.)<p>2. Guess the highest number the client will agree pay for the project. (This is also hard. I find that saying things like, "Do you see this as a small $5000 project or a more substantial $50,000 effort?" is useful.)<p>3. If that results in an acceptable hourly rate for you, propose this as a flat fee to the client. Otherwise, figure out how to make the project smaller or leave.<p>4. Do the project and bill the client with an invoice that makes your hourly rate clear. (If the project takes longer than you expected, give the client those hours for free. If the client tries to add more stuff to the project, refuse to do those things under this contract.)<p>5. Now you've established an hourly rate with that client. If you did a good job and the client is reasonable, you can now do future projects on an hourly basis.<p>Eventually, you will want to raise your rates, which is hard to do. I've found it easier to just make higher flat estimates, and then finish them faster, making my effective hourly rate higher. The key here is that people balk at $XXX per hour, but they'll often pay $XX,XXX at that rate if it's for something they need.<p>There's definitely the risk with this algorithm that you will charge too little and work too long. I think the hard truth is that even "hourly" projects are usually charged a flat fee, plus or minus a few percent, because most clients aren't lying about their budgets. If you estimate a project at 100 hours at $150 per hour, they will expect you to complete the project for something very close to $15,000. If you end up saying, "Well, that was just an estimate. It actually took 200 hours, so you owe me $30,000," they might pay, but they won't hire you again, which makes your hourly rate terrible because you have to spend free hours finding a new client.<p>I think the right knob to tweak in doing work on a project basis is often quality. If you've agreed to do X for $XX,XXX, the price is defined with great precision. The project is not. You should strive to deliver the best results you can, but you can omit the engineering polish you'd like to put in-- finishing on time and on budget is its own kind of polish, and one that people who hire consultants particularly appreciate.<p>Edit: I should add that putting free polish on a project is often the best sales work you can do.