Triboelectric nanogenerators (TENGs) harvest and convert mechanical energy to electrical energy. TENGs that are transparent and flexible can be applied to various (opto-)electronic devices supporting finger- or pen-based touchscreen inputs. This paper presents a transparent, flexible TENG that harvests mechanical tapping energy (typically discarded) by simple placement on touchscreen devices. The developed TENG consists of flexible and transparent conducting electrodes (FTCE) with high transmittance (> 93%) and low sheet resistance (18.5 Ω/sq), and transparent 3D-hierarchical polydimethylsiloxane (PDMS) with porous pyramid-patterns. In this study, the developed TENG directly powered eight light-emitting diodes (LEDs) by harvesting the mechanical energy produced by tapping with a touch pen while playing a smartphone game. We also used the transparent TENG as a transparent single-electrode-based, self-powered raindrop detection sensor on a window for a smart home. Our results indicate that the proposed TENG can be used not only as an effective mechanical energy harvester for transparent, flexible, and next-generation optoelectronics devices but also as a self-powered sensor for future Internet-of-Things applications. © 2018 Elsevier Ltd