get local ip with javascript

Get Local IP Address (Private IP) with JavaScript


Once you connect your computer device to a router with default settings, it will automatically assign you a local IP address. Unlike public IP addresses that are traceable, it is not easy to get Local IP address as it is hidden from the external world and is used specifically in your private network.


Once your router connects (your modem, wifi network access point, etc..)to the internet through your ISP, it conveys internet activity to all the devices connected to the router. This forms the Network Address Translation (NAT) process. This is where the router converts your local private IP into a public IP when sending traffic over the internet. When you receive traffic, the Router will then reverse the Public IP to a private IP. This demonstrates that your Local IP is visible to you, your router and your network.  It is your private ID. If anyone know your public IP, it is mean that your router IP, location, ISP is known. But they can not know which device exactly you are using behind your public IP. To know that,they need your local IP, or MAC address. So question is  how do you get local IP address via browser? Answer: WerbRCT


WEBRTC is a platform that enables real time communication between browsers and mobile applications. WEBRTC and HTML5 are linked as WEBRTC is composed of three HTML5 APIs. This JavaScript coded specification is supported by browsers like Chrome, Firefox, Opera and Safari. This open-source technology makes it easy for browsers to transmit and retain real time data.


Retrieving a local IP address was almost impossible before the introduction of WEBRTC. JavaScript enables one to get Local IP address using the RTC peer connection.

As explained above, WEBRTC allows timely communication between your computer device and other remote peers by using an RTC connection interface. So as to obtain a local IP address using JavaScript, one needs to create another “Uninterrupted” version of it.

The createOffer method creates the generation of a Session Description Protocol (SDP). This provides any information about media transmissions done over the WEBRTC and all other data attached to it including the local IP address.

By using JavaScript, one is only able to get Local IP address and not the Public IP. If you have privacy concerns and you want your Local IP to remain invisible, you should disable WEBRTC on your browser.


Before Disable Check Your Browser For WebRTC Leak 

HOW TO DISABLE WEBRTC ON CHROME (with extension webRTC Control)

Step 1: Go to the customize and control option on the web page, go to “more tools” and then click “Extensions”.

Step 2: Go to the “Extensions”, scroll down and select “Get more extensions”.

Step 3: On the left corner, you will see the “search bar”. Type “WebRTC control“.

Step 4: On the tab that will appear, click “Add to Chrome”.

Step 5: Select again “Add to Extensions”.

Step 6: Once you activate the plugin, make sure that the “WebRTC Plugin” icon turns blue to disable.


Step 1: On the address bar, input the text “about:config”. Press enter.

Step 2: Select the option of “I accept the Risk”

Step 3: On the search bar, further input “media.peerconnection.enabled”. Press enter.

Step 4: On the line listed, right click and select “Toggle”. This will disable WebRTC.

HOW TO DISABLE WEBRTC ON EDGE (without extension)

Step 1: Type “about:flags” on the address bar.

Step 2: In the WebRTC option, check on the box written “Hide my Local IP address over WebRTC connections”.

You should note that on Microsoft Edge, there is no option of disabling WebRTC completely. However, the above steps will hide your Local IP address.

Check Your Browser  Again For WebRTC Leak 



Comments on the post