In this study, we synthesized an imidazolium iodide–containing hyperbranched polymer ionic liquid (HPIL) for use as the gel electrolyte of dye-sensitized solar cells (DSSCs). We incorporated HPIL at various contents (4, 8, and 15 wt%) in a solvent-free ionic liquid (1-propyl-2,3-dimethylimidazolium iodide and 1-ethyl-3-methylimidazolium tetrafluoroborate)–based quasi-solid gel electrolyte (IL-A) and a solvent (3-methoxypropionitrile)-based fluid gel electrolyte (IL-B). After fabricating N719 dye–based DSSCs incorporating the HPIL/IL-A and HPIL/IL-B gel electrolytes, we recorded the electrochemical impedance spectra and measured the photovoltaic (PV) performance of these devices. In the dark, the DSSCs incorporating HPIL exhibited higher charge recombination resistances at the interface between TiO2/dye and the electrolyte. This high recombination resistance suppressed the dark current and improved the PV performance of the devices incorporating HPIL. The DSSCs fabricated from the HPIL/IL-B gel electrolyte displayed higher photo-conversion efficiency, while those fabricated from the HPIL/IL-A gel electrolyte provided superior operational stability. Under AM 1.5 illumination (100 mW cm−2), we measured a photo-conversion efficiency of 7.18 %, a short-circuit current density of 16.09 mA cm−2, an open-circuit voltage of 0.69 V, and a fill factor of 0.65 for the DSSC incorporating the gel electrolyte HPIL/IL-B (4:96, w/w). The DSSC incorporating the gel electrolyte HPIL/IL-A (15:85, w/w) exhibited good operational stability, retaining approximately 93 % of its original efficiency after 500 h.