Investigating the existence of algebra and finding hidden symmetries in physical systems is one of the most important aspects for understanding their behavior and predicting their future. Expanding this unique method of study to cosmic structures and combining past knowledge with new data can be very interesting and lead to discovering new ways to analyze these systems. However, studying black hole symmetries always presents many complications and sometimes requires computational approximations. For example, checking the existence of Killing vectors and then calculating them is not always an easy task. It becomes much more difficult as the structure and geometry of the system become more complex. In this work, we will show that if the wave equations with a black hole background can be converted in the form of general Heun equation, based on its structure and coefficients, the algebra of the system can be easily studied, and computational and geometrical complications can be omitted. For this purpose, we selected two [Formula: see text] black holes: Reissner–Nordstrm (RN) and Kerr, and analyzed the Klein–Gordon equation with the background of these black holes. Based on this concept, we observed that the radial part of the RN black hole and both the radial and angular parts of the Kerr black hole could be transformed into the general form of the Heun equation. As a result, according to the algebraic structure that governs the Heun equation and its coefficients, one can easily achieve generalized sl(2) algebra.