Narrative:

Entire flight was with radio and transponder using flight following. I was in contact with ZZZ approach as I neared the outer edge of ZZZ1 airspace I heard ZZZ approach calling me (I assume to change frequency to ZZZ1 approach). I responded to them but they could not hear me. After several tries I switched frequency to ZZZ1 approach and called them; they also could not hear me; thinking I had a radio issue I set transponder to 7600 and pinged. No response. I was at this point at 3500 ft altitude; just inside ZZZ1 outer ring about 25 miles out. At this point I noticed all the radio and transponder lights dimming and going out; I reduced my elevation to 1500 ft and using my cell phone called the tower to notify them of my altitude and location; I stayed below the class B airspace and landed at ZZZ2 to assess what repairs were needed.

Google
 

Original NASA ASRS Text

Title: C182 pilot reported an electrical failure and loss of radio and transponder on a flight through Class Bravo airspace. He elected to divert to a nontowered airport.

Narrative: Entire flight was with radio and transponder using flight following. I was in contact with ZZZ approach as I neared the outer edge of ZZZ1 airspace I heard ZZZ Approach calling me (I assume to change frequency to ZZZ1 Approach). I responded to them but they could not hear me. After several tries I switched frequency to ZZZ1 Approach and called them; they also could not hear me; thinking I had a radio issue I set transponder to 7600 and pinged. No response. I was at this point at 3500 ft altitude; just inside ZZZ1 outer ring about 25 miles out. At this point I noticed all the radio and transponder lights dimming and going out; I reduced my elevation to 1500 ft and using my cell phone called the tower to notify them of my altitude and location; I stayed below the Class B airspace and landed at ZZZ2 to assess what repairs were needed.

Data retrieved from NASA's ASRS site and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.