It’s surprising. Most people have only a vague idea of what they can afford when it comes to getting a new or used car. Some people think in terms of the basic cash price, while others think only of what the monthly payment will be.

Both approaches have flaws.

There’s more to buying a vehicle than the initial cost, even if you pay cash. There are car insurance, fuel and maintenance costs. Buying almost any vehicle — whether it’s fresh from the showroom or new to you — will mean higher insurance rates. Maintenance on a used car, even one just three years old, may be required sooner than you think. And going from that small sedan in your driveway to a flashy new SUV will mean shelling out more per month at the gas station.

Setting out to buy a car with just a ballpark monthly payment in mind — whether leasing or financing — is a surefire way to pay more than you might otherwise.

Determine your budget

So sit down and look at all your household expenses, as well as cash on hand and take-home pay, and determine what you can reasonably afford to pay for a car. If you’ve never done it before, take this opportunity to build a household budget. Bankrate’s story on family budgeting has a downloadable interactive spreadsheet you can use to build your own budget.

Need a rule of thumb? If you’re devoting more than 15 to 20 percent of your household income to transportation, you should probably scale back.