This paper presents the Cost Optimization of hybrid energy systems in two of the most important provinces of Afghanistan, electrification of Khulm district (Uljato) for Balkh province and Zendeh Jan district (Hotel Safid) for Herat province is purposed in this study. HOMER (Hybrid Optimization Model for Electric Renewables) pro version 3.23.8 is used for optimization, simulation and sensitivity analysis, HOMER is a great software to design and evaluate technically and financially the options for off-grid and on-grid power systems. Renewable resources for selected areas are analyzed in Global Solar atlas (GSA) and Global wind atlas (GWA} the result is compared with the meteorological tower data set, the GSA/GWA is the online website that provides a summary of solar potential, solar resources, wind speed, wind density, and other related factors globally. it is provided from World Bank Group with funding from the Energy Sector Management Assistance Program (ESMAP). The modeling of the hybrid system is purposed as grid-connected for both sites, the system is designed for 2.348MW and 1.622MW for Khulm and Zendeh Jan district respectively, and 10% of load variability is considered. as a result of the study, the Levelized cost of energy (LCOE) from the hybrid system is obtained 0.0566 USD/kWh and 0.0537 USD/kWh for Khulm and Zendeh Jan district respectively which will be 30 to 50 percent cheaper than the price of electricity that is imported from neighboring countries. The total electricity generation for Khulm and Zendeh Jan districts from solar and wind are 7,988,376 kWh/year and 6,218,710 kWh/year respectively. Accessibility of electricity is the important factor for the economic growth of Afghanistan, more than 1000MW of electricity is imported from neighboring countries that are not sustainable and reliable, while Afghanistan has a great potential of renewable energy sources (REs) whose utilization could help to lessen future supply gaps at a cost level that are economically and financially attractive The development of domestic generation is vital for Afghanistan and renewable energy sources (RES) with great potential can successfully be harnessed to meet these two requirements. Besides these renewable energies (REs) are clean energies, friendly with the environment, free of harmful emissions, and have a great impact on the reduction of global warming and climate change.