This work describes an ab initio principle computational examination of the optical, structural, elastic, electronic and mechanical characteristics of aluminum-based compounds AlRF3 (R = N, P) halide-perovskites. For optimization purposes, we used the Birch–Murnaghan equation of state and discovered that the compounds AlNF3 and AlPF3 are both structurally stable. The IRelast software was used to compute elastic constants (ECs) of the elastic properties. The aforementioned compounds are stable mechanically. They exhibit strong resistance to plastic strain, possess ductile nature and anisotropic behavior and are scratch-resistant. The modified Becke–Johnson (Tb-mBJ) approximation was adopted to compute various physical properties, revealing that AlNF3 and AlPF3 are both metals in nature. From the density of states, the support of various electronic states in the band structures are explained. Other various optical characteristics have been calculated from the investigations of the band gap energy of the aforementioned compounds. These compounds absorb a significant amount of energy at high levels. At low energy levels, the compound AlNF3 is transparent to incoming photons, whereas the compound AlPF3 is somewhat opaque. The examination of the visual details led us to the deduction that the compounds AlNF3 and AlPF3 may be used in making ultraviolet devices based on high frequency. This computational effort is being made for the first time in order to investigate the aforementioned properties of these chemicals, which have yet to be confirmed experimentally.