The goal of this paper is to develop and apply an accurate mathematical model to investigate and optimize the effects of texturing on the diffusion of dopants in modern textured solar cells. This investigation will help out the manufacturers and designers of solar cells optimize the texturing geometry and its parameters. The findings in this paper will also help maximize the optical and electrical performance of innovative solar cells and reduce their production cost. For example, non-optimized texturing pyramids obtained from a texturing chemical reaction will reduce the absorption of the sun light. It will also cause excessive defects on the surface of the cell which will affect negatively the diffusion of dopants and the solar cell efficiency. We found that texturing angles around 30° could improve both the diffusion of dopants and the efficiency of the solar cell. Two dimensional numerical results showing the effects of texturing geometry on boron ion diffusion in a sample solar cell will be presented, analyzed, and validated with literature.