This online IP address converter converts dotted-decimal IP address to binary, octal, hexadecimal and dword/decimal notations.

IP address:
Octal:
Hexadecimal:
Dword/Decimal:
Binary:
HTML
CSS
JavaScript
<div id="converter">

<div>
<span style="margin-right:35px">IP address: </span><input id="ip" type="text" placeholder="000.000.000.000">
</div>

<div class="notation">
<span style="margin-right:66px">Octal: </span><input id="oct" type="text"> <i class="fas fa-clipboard hidden"></i>
</div>

<div class="notation">
<span style="margin-right:19px">Hexadecimal: </span><input id="hex" type="text"> <i class="fas fa-clipboard hidden"></i>
</div>

<div class="notation">
<span style="margin-right:3px">Dword/Decimal: </span><input id="dword" type="text"> <i class="fas fa-clipboard hidden"></i>
</div>

<div class="notation">
<span style="margin-right:58px">Binary: </span><input id="bin" type="text"> <i class="fas fa-clipboard hidden"></i>
</div>

<div style="margin:18px 0 0 192px">
<button id="convert">Convert IP Address</button>
</div>
</div>
.applet-body {
  border: none !important;
}
#converter {
  margin-top: 30px;
  font-size: 15px;
  border-radius: 5px;
}
#converter input {
  font-size: 16px;
  padding: 3px;
  width: 321px;
}
#convert {
  border: 1px solid #131f2d;
  background: #142944;
  color: #fff;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
}
#convert:hover {
  background: #203754;
}
#converter .notation {
  margin: 5px 0;
}
.fa-clipboard {
  color: #abb2bd;
  cursor: pointer;
}
.hidden {
  display: none;
}
#guide {
  margin-top: 120px;
  font-size: 14px;
}
document.querySelectorAll('#converter .fa-clipboard').forEach(el => {
  el.onclick = function () {
    const value = this.parentNode.querySelector('input').value;
    navigator.permissions.query({name: 'clipboard-write'}).then(result => {
      if (result.state == 'granted' || result.state == 'prompt') {
      navigator.clipboard.writeText(value).then(function() {
        el.style.visibility = 'hidden';
        setTimeout(function () {
          el.style.visibility = 'visible';
        }, 100);
      }, function() {
        /* clipboard write failed */
        });
      }
    });
  };
});

document.querySelector('#convert').onclick = convert;
document.querySelector('#ip').onkeyup =function(e) {
  if (e.keyCode === 13) convert();
}

let clipboardHidden = true;
function convert() {
  const ip = document.querySelector('#ip').value;
  if (ip) {
    let bin = '';
    let oct = '';
    let dword = '';
    let hex = '';
    let random = '';
    ip.split('.').forEach(n => {
      dword += ('0000000' + (+n).toString(2)).slice(-8);
      bin += ('0000000' + (+n).toString(2)).slice(-8);
      oct += ('000' + parseInt(n).toString(8)).slice(-4) + '.';
      hex += '0x' + parseInt(n).toString(16) + '.';
    });
    dword = parseInt(dword, 2);
    oct = oct.replace(/\.$/, '');
    hex = hex.replace(/\.$/, '');

    document.querySelector('#bin').value = bin;
    document.querySelector('#oct').value = oct;
    document.querySelector('#dword').value = dword;
    document.querySelector('#hex').value = hex;
    if (clipboardHidden) {
      document.querySelectorAll('#converter .fa-clipboard').forEach(el => {
        el.classList.remove('hidden');
      });
    }
  }
}

Usage Guide#

The most familiar IP address format is the dotted-decimal notation. Eg: 192.168.0.1. Other formats are:

  • Octal notation: IP address is represented in the octal number system
  • Hexadecimal notation: IP address is represented in the hexadecimal number system
  • Dword/Decimal notation: IP address is represented in the decimal number system without the dots
  • Binary notation: IP address is represented in the binary number system

What can this converter do?

This IP address converter takes an IP address in the dotted-decimal format and converts it into the corresponding binary, octal, hexadecimal and dword/decimal IP addresses.

How to use the converter

Enter the dotted-decimal IP address in the "IP address" field located at the top and hit enter or click the "Convert IP Address" button. The IP address will be then generated in binary, octal, hexadecimal, and dword/decimal notations, click on the clipboard icon next to the input fields to copy the converted formats.

Uses of an IP address converter

Maybe you need to specify the IP address in a different format on some system? Or maybe you are just curious how they look like in other notations? Maybe you need to pass a test?

Whatever be your requirement, an IP address converter helps you generate the IP address in a specific format instantly. An online IP address converter is especially handy because you don't have to install any software.

Tweet this | Share on LinkedIn |