The effects of rubidium doping on the structural, electronic, and optical properties of KTiOPO4 (KTP) are investigated in the framework of density functional theory. The equilibrium structural parameters of KTP and RbTiOPO4 (RTP) are calculated within the local density and Perdew-Burke-Ernzerhof (PBE), Wu-Cohen, and PBEsol formulation of generalized gradient approximations. We discuss that PBEsol predicts better equilibrium parameters for the KTP alloy. In addition, the variation of lattice constants and Ti-O-Ti bond angles are evaluated as a function of rubidium concentration. The modern modified Becke-Johnson functional is applied for more accurate band gap determination in the pure and alloyed KTP/RTP compounds. The phenomenological pseudoinversion parameter is calculated for a qualitative understanding of the effect of impurity on a non-linear optical response of KTP. We also analyze the behavior of the dielectric function, dispersive refractive indices, and birefringence of KTP/RTP alloys.