Google and many other sites know my correct location. How can I fake my location without using a VPN, proxy, Tor or similar?

I went to about:config and looked for geo. What I think I have to modify is geo.wifi.uri? Maybe we can put in false lattitude and longitude values directly? If so, how would it look then? I really have no idea about the format.

Or is there another way using JavaScript in Greasemonkey?


Faking the Geolocation

You can spoof the location provided via the HTML5 Geolocation API this way:

  • Go to about:config.

  • Type in geo.provider.network.url (or geo.wifi.uri in older versions)

  • Change the value to something like this:

    data:application/json,{"location": {"lat": 40.7590, "lng": -73.9845}, "accuracy": 27000.0}

    (The lat and lng values determine the latitude and longitude of your location.

  • Confirm that geo.enabled is true.

  • You may also need to set geo.provider.testing to true. (Create the key if it doesn't exist.)

  • Congratulations, you're now on Times Square! (Verify the result here.)

Note: This does not stop websites from deriving the location from your IP address. You can't do that on the application layer and would have to go with a proxy instead.

Disabling the Geolocation

For privacy reasons, you may want to prevent use of the API entirely:

  • Go to about:config and set geo.enabled to false.

Some technical details

The Geolocation service in Firefox is set up in dom/geolocation/Geolocation.cpp. Following nsGeolocationService::Init() you see that without geo.enabled, the API initialization is aborted right away:

  if (!StaticPrefs::geo_enabled()) {
    return NS_ERROR_FAILURE;

Further, the browser chooses between different location providers based on your platform and settings. As you see, there are prefs to switch them individually (e.g., if you're on MacOS, you can set geo.provider.use_corelocation to false to disable geolocating via Apple's Core Location API):

  mProvider = new AndroidLocationProvider();

#  ifdef MOZ_GPSD
  if (Preferences::GetBool("geo.provider.use_gpsd", false)) {
    mProvider = new GpsdLocationProvider();
#  endif

  if (Preferences::GetBool("geo.provider.use_corelocation", true)) {
    mProvider = new CoreLocationLocationProvider();

#ifdef XP_WIN
  if (Preferences::GetBool("geo.provider.ms-windows-location", false) &&
      IsWin8OrLater()) {
    mProvider = new WindowsLocationProvider();

  if (Preferences::GetBool("geo.provider.use_mls", false)) {
    mProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");

Only if none of the platform-specific providers apply, or if geo.provider.testing is true, Firefox defaults to the network (URL-based) provider:

  if (!mProvider || Preferences::GetBool("geo.provider.testing", false)) {
    nsCOMPtr<nsIGeolocationProvider> geoTestProvider =

    if (geoTestProvider) {
      mProvider = geoTestProvider;

The network provider (dom/system/NetworkGeolocationProvider.jsm) then requests the URL specified in geo.provider.network.url. You could set up your own mock HTTP location serivce and enter its URL here. But more easily, as in the steps at the top, it's sufficient use a data: pseudo URI to mimic a network provider that unconditionally responds with your desired location details.

  • Technically, you can often spoof geoip information directly without using a proxy, but that usually requires the IP being on an autonomous service which you have at least some influence over.
    – forest
    Apr 10 '18 at 4:14
  • 2
    This requires restarting Firefox. And please change that w3schools link to MDN or anything else! Jul 25 '18 at 9:31

As long as your traffic is going directly to them (that is, not through a proxy of some sort), they will have your IP and thus a rough geographic location.

How can I fake my location without vpn / proxy / tor etc.?

Why do you have this restriction?

  • Geolocation is a particular web API, I assume OP doesn't want to hide the IP but trick that API.
    – Arminius
    Jan 3 '17 at 23:27
  • 1
    @Arminius I think it is unclear if the question is about "the HTML5 geolocation API" or just "any geolocation techniques in general".
    – Anders
    Jan 4 '17 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.