All Rounder Tools Blogger-Best blog for blogger: Binary to HEX converter Tool with colorful styling and all its features use any free library...

Wednesday, September 25, 2024

Binary to HEX converter Tool with colorful styling and all its features use any free library...

 

Binary to HEX Converter

Binary to HEX Converter

Hexadecimal Output:

body { background-color: #f8f9fa; } .card { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } #hexOutput { font-weight: bold; color: #007bff; font-size: 1.5rem; } document.getElementById("convertButton").addEventListener("click", function() { const binaryInput = document.getElementById("binaryInput").value; const hexOutput = document.getElementById("hexOutput"); // Validate binary input if (/^[01]+$/.test(binaryInput)) { // Convert binary to decimal const decimal = parseInt(binaryInput, 2); // Convert decimal to hexadecimal const hex = decimal.toString(16).toUpperCase(); hexOutput.textContent = hex; } else { hexOutput.textContent = "Please enter a valid binary number."; hexOutput.style.color = "red"; } });

No comments:

Post a Comment