Get user’s country name and country flag based on his IP address I have used 3 API to do this project: api.ipify to get user’s IP address. ipapi to get the country code based on the IP address return by ipify. restcountries to get country name and flag based on the code. See the Demo