This is another question I get often, and my answer is always, “It depends.”
If you get solar panels for your home based on average usage, you will save on electric bills. In some cases, you can feed back to the grid what you are not using and get credits on your electric bill. Solar panels in general lasts about 25 years (of effective panel power output). The payoff or ROI (return on investment) can be as short as several years (if you don’t use that much electricity) and 15 years or more, if you use enough electricity (the solar panel consultants will give you a fairly accurate ROI.) There may be local and federal credits to reduce the initial investment. You can buy or lease the solar panels, and I highly discourage leasing the solar power system as you never own the panels, you don’t get the local and federal credits (the lessor gets it), and it is difficult to find a buyer who will accept the terms of the solar power system lease.
Now, is it worth buying it outright? Maybe, only if you can store the unused energy into a battery bank and when the grid power goes out, it automatically cuts over to the battery power. There are manufacturers that provide wall panels with Lithium Polymer batteries that store the energy when more power is generated that is not in use. Some of the smarter battery based power storage systems, allows you to use grid power when prices are low, and store as much of the power as possible, and use battery power when the grid power prices are at peak pricing. This will keep your electricity bill very low to $0, and when everyone else in your neighborhood has a power outage, you will still have power, though things like cable TV and internet may not be available if it is a prolonged power outage where the backup power is depleted for the provider’s equipment. Payoff or ROI for this type of solar power system is going to be over 20 years. The additional equipment to provide battery storage, automatically transfer from grid to stored battery power, and any other equipment and smart electronics cost almost as much as the panels, and sometimes more.
Why I still say, “Maybe,” is you can’t take it with you. This must remain on the property when you sell your home. When there is a mandatory evacuation, it stays as you bug out. If money is no object, then this is a great way to provide power when there is an outage. The best use case will be for an off-grid home, where there is no grid power. Carefully make the decision about solar panels for your home. I personally do not have solar panels on my home for the reasons I wrote on this post.