The electric industry has undergone a recent revolution, with global energy demand witnessing a substantial surge in the 21st century, primarily driven by overpopulation and urbanization. As energy demands continue to rise, the urgent need for sustainable energy sources and effective carbon emissions reduction strategies becomes evident. This study presents a comprehensive analysis of energy consumption and carbon footprint (CF) in an electrical tramline, showcasing the potential of renewable energy sources in significantly reducing carbon emissions. The novelty of this research lies in the development of a quantitative model for estimating potential regenerative braking energy (RBE), as well as the integration of renewable energy sources to curb CF in the transportation sector. The paper proposes a quantitative model to estimate the speed profile of the tramline based on the vehicle's dynamic data and line geometry parameters. The mathematical model is successfully simulated as an m-file using the MATLAB® program. The findings indicate that a remarkable 27.60% of the yearly consumed energy can be potentially regenerated, resulting in a carbon dioxide (CO2) reduction of 278.5 tons for a full cycle trip. Moreover, by complementing the tramline with station rooftop solar power plants, the energy savings can be amplified to 58%, leading to a relative enhancement in the reduction of the carbon footprint. This article emphasizes the key advantages of harnessing regenerative braking energy and integrating renewable energy sources in the context of electrical railways. It underscores the paramount importance of transitioning towards sustainable energy solutions to tackle the challenges posed by climate change and ensure energy security for future generations.