What if a gallon of gasoline cost $3 at breakfast time, was free at lunch, dinged you $8 in the afternoon, but was only $2 in the middle of the night? Welcome to the world of charging up plug-in electric vehicles.

If you buy an electric car, the cost of a fill-up will largely depend on when and where you recharge it and what rates your utility company offers. For the bigger picture of what it costs to charge a plug-in car, you should include the amortized cost of buying and installing a home charging station. If you're considering using solar energy to power your car, the cost of a home solar system might also figure into the equation.

It sounds complex, but determining the cost of a plug-in vehicle's daily juice habit isn't difficult once you understand all the individual cost points.

Measuring Energy Consumption

First up is knowing how to measure energy consumption. When you're shopping for a gas-powered car, you look at the miles per gallon rating that the car has received. For plug-in vehicles, mpg isn't the metric. Instead, an electric car's energy consumption is measured in kilowatt-hours per 100 miles (kWh/100 miles). That rating is on the car's EPA fuel economy sticker and in the owner's manual. Additionally, the federal Department of Energy, which establishes the energy-use ratings, keeps track of them on its fuel economy site, one efficiency list for pure electric cars and another for plug-in hybrids.

It takes 33.3 kWh to equal the energy in a gallon of gasoline. At average electricity rates around the country in mid-2018, that energy could cost as little as $3.08 or as much as $10.53. To figure out your cost of charging at home, multiply your vehicle's kWh/100 miles figure by the electric rate for the time of day you'll most often be charging (more about that in a minute). That figure will tell you the cost per 100 miles.

You also can work from the total kilowatt-hours it takes to recharge the EV's battery. If an EV requires 40 kWh to recharge a fully depleted battery, and the rate is 18 cents per kWh, that's $7.20 for a fill-up.

Cost to Charge

While you might occasionally be able to charge for free at a public station, that's not something you can count on. Most electric-car owners charge at home, and so you'll need to know what it costs to charge there.

The cost of electricity is much more stable than the cost of gasoline, but it varies tremendously in the U.S. The residential average per kilowatt-hour currently ranges from 9.3 cents in Louisiana to 31.6 cents in Hawaii. The national average is 12.7 cents, which is only about a penny more than it was a decade ago. To find your state's average, check this state-by-state list of the average cost per kilowatt-hour.

Your state's average is just that, however. What you pay is determined by your utility company and the plan you use. Utility companies typically have two types of rate plans. In level-of-use plans, electricity cost rises with your consumption. A kilowatt at month's end is likely to cost more than one used on the first day.

With time-of-use plans, you pay by time of day in which you're using electricity. Electricity that you use at peak hours costs the most. Some plans divide the day into peak and off-peak periods. Some also have midpeak slots.

To show how these plans work, we'll use the example of Southern California Edison, based in the state where most electric cars are sold. Southern California Edison has a triple-tier, consumption-based basic monthly plan for residential users that starts at 18 cents per kWh and rises to 37 cents. The utility also has six optional residential time-of-use plans. All of them charge the most for consumption in late afternoon and early evening.

One of the plans charges separately for household use and EV charging, with lower rates for the cars. But this requires the installation of a separate meter for the home EV charging station. That can cost well over $1,000.

Depending on the Southern California Edison rate plan, a 2018 Tesla Model 3, rated at 26 kWh/100 miles, would cost as little as $1.56 for 50 miles' worth of power if home charging started at 11 p.m. Or it could cost four times as much, $6.37, if the car was routinely charged during peak hours.

On the separate-meter time-of-use plan during the peak noon-9 p.m. period, that charging session would run $4.81. It would be $2.21 the rest of the time.

Costs for a Home Charging Setup
In addition to understanding what it will cost to power an EV, it's also important to know the cost of a key piece of technology: the electric vehicle supply equipment (EVSE), along with the cost of its installation. Another potential cost is a residential solar power system, which a growing number of people are considering, either for vehicle charging alone or for powering the car plus household. Let's break down what these things cost.

The Electric Vehicle Supply Equipment: $200-$1,000
Plug-in vehicles today typically come with the ability to charge at home on standard household current, 120 volts, which is called Level 1 charging. They also can charge on faster 240-volt circuits, called Level 2 charging.

If the vehicle has a small battery, under 10 kWh, you can often make do with the Level 1 charging system that comes with the vehicle. For plug-in cars with larger batteries, Level 2 is your best bet for overnight charging and quick top-ups.

Most automakers with plug-in vehicles in their lineups have a preferred charger provider, but there are dozens of companies selling EVSEs. A search online will help you find the features, power output and pricing that best suits your need. Just search for EVSE or EV home chargers. Prices for quality Level 2 home systems can range from just under $200 to more than $1,000 before installation.

Cost of Installation: $800-$1,300
Installation costs for EVSEs vary by region, depending on such factors as local labor rates, materials used, and government permit costs and requirements.

The biggest variable is permit costs, said Ken Sapp, general manager of Qmerit's Energy and EV Solutions unit. The Southern California company specializes in connecting homeowners with qualified EVSE installers throughout the U.S.

Nationally, average costs for a home EVSE installation with a short and uncomplicated 10-foot wiring, which runs from the electrical service box to the charging station location, range from $800 to $1,300, Sapp said.

The costliest region is the Western U.S., where installation can run from $950 to $1,300. The Central U.S. states have the least expensive costs, at $800 to $1,100. Costs in the Southeast states can range from $850 to $1,150, while Northeast costs range from $900 to $1,200.

The Costs of a Solar System: $7,000 and Up
Unless you'll be charging electric cars for many years to come, it can be difficult to make an economic case for installing a solar system just to serve your EV.

In the Los Angeles area, a 1-kilowatt solar system will produce an average of 4 kWh of power per day. A Chevrolet Bolt, which is EPA rated at 28 kWh/100 miles, and is one of the more efficient EVs available, would need at least a 3.5-kW system to get 50 miles of range per daily charge. Such a system costs about $7,000 and doesn't include the cost of a storage battery to hold power for overnight charging. That feature could double the cost. Put another way, a $7,000 system would purchase almost 140,000 miles' worth of power for a Bolt, assuming a rate of 18 cents per kWh.

Solar starts to make more sense if you get a system capable of providing electricity for the household as well as the EV.

Upfront costs of owning a solar system outright can be steep. But on average, a properly sized whole-house solar system will pay for itself over about seven years and will last for at least 25 years. Costs are largely dependent on the size of the system being installed, regional labor rates, the quality of the solar panels and power inverter being used, and the complexity of the installation.

The national average installed cost of a 6-kW system is $13,278, or $2.21 per watt, after applying the 30 percent federal tax credit, according to EnergySage, a Boston-based service that links homeowners with solar system providers across the country.

The range across the country varies from $9,200 to $16,044. In California, a 6-kW system can run from $12,000 to more than $15,000 after the credit. There are a number of solar system financing and leasing programs, and some utilities also offer incentives.

Summing Up

EV charging is unfamiliar territory for anyone raised in a gas-car culture. But it's getting easier all the time to find the electric vehicle supply equipment and rate plan that make ownership of a plug-in car as easy as flipping a light switch.