-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinary-calculator.html
More file actions
120 lines (117 loc) · 9.07 KB
/
binary-calculator.html
File metadata and controls
120 lines (117 loc) · 9.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binary Calculator — Add, Subtract, Multiply Binary Numbers</title>
<meta name="description" content="Perform binary arithmetic: add, subtract, multiply, divide, and bitwise operations (AND, OR, XOR, NOT). Step-by-step results. Free online binary calculator.">
<link rel="canonical" href="https://www.quicktools.mom/binary-calculator.html">
<meta property="og:title" content="">
<meta property="og:description" content="">
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.quicktools.mom/binary-calculator.html">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="style.css">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2658921743607446" crossorigin="anonymous"></script>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"📊 Input Values
BinaryDecimalHex
A
B
Result
Ad Space — 336×280
FAQWhat are bitwise operations?","acceptedAnswer":{"@type":"Answer","text":"Bitwise operations work on individual bits: AND (&) returns 1 only when both bits are 1; OR (|) returns 1 when either bit is 1; XOR (^) returns 1 when bits differ; NOT (~) flips all bits."}}]}</script>
</head>
<body>
<div class="page-wrapper">
<header class="site-header"><a href="index.html" class="site-logo"><span class="icon">⚡</span> QuickTools</a><nav class="site-nav"><a href="index.html">All Tools</a></nav></header>
<div class="ad-zone ad-zone-top">Ad Space — 728×90</div>
<div class="tool-header">
<div class="tool-badge">🧮 Math</div>
<h1>Binary Calculator</h1>
<p>Perform binary arithmetic and bitwise operations with step-by-step results.</p>
</div>
<div class="tool-card">
<div class="controls-row">
<div class="control-group"><label>Number A (Binary)</label><input type="text" id="numA" value="11011" class="mono" style="font-size:1.2rem;letter-spacing:0.1em;" oninput="calc()"></div>
<div class="control-group"><label>Operation</label><select id="op" onchange="calc()" style="font-size:1.1rem;"><option value="+">+ Add</option><option value="-">− Subtract</option><option value="*">× Multiply</option><option value="/">÷ Divide</option><option value="&">& AND</option><option value="|">| OR</option><option value="^">^ XOR</option><option value="~">~ NOT (A only)</option><option value="<<"><< Left Shift</option><option value=">>">>> Right Shift</option></select></div>
<div class="control-group"><label>Number B (Binary)</label><input type="text" id="numB" value="1010" class="mono" style="font-size:1.2rem;letter-spacing:0.1em;" oninput="calc()"></div>
</div>
</div>
<div class="tool-card" style="text-align:center;">
<div class="text-muted" style="font-size:0.85rem;">Result (Binary)</div>
<div id="resultBin" style="font-size:2.5rem;font-weight:700;font-family:monospace;color:var(--accent-hover);letter-spacing:0.1em;">0</div>
<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-top:1.5rem;">
<div style="padding:0.75rem;background:var(--bg-secondary);border-radius:var(--radius);">
<div class="text-muted" style="font-size:0.75rem;">Decimal</div>
<div id="resultDec" style="font-size:1.3rem;font-weight:600;font-family:monospace;">0</div>
</div>
<div style="padding:0.75rem;background:var(--bg-secondary);border-radius:var(--radius);">
<div class="text-muted" style="font-size:0.75rem;">Hexadecimal</div>
<div id="resultHex" style="font-size:1.3rem;font-weight:600;font-family:monospace;">0x0</div>
</div>
<div style="padding:0.75rem;background:var(--bg-secondary);border-radius:var(--radius);">
<div class="text-muted" style="font-size:0.75rem;">Octal</div>
<div id="resultOct" style="font-size:1.3rem;font-weight:600;font-family:monospace;">0o0</div>
</div>
</div>
</div>
<div class="tool-card">
<h3 style="font-size:0.95rem;margin-bottom:1rem;">📊 Input Values</h3>
<div style="display:grid;grid-template-columns:60px 1fr 1fr 1fr;gap:0.3rem 1rem;font-size:0.85rem;line-height:2;font-family:monospace;">
<span></span><span class="text-muted">Binary</span><span class="text-muted">Decimal</span><span class="text-muted">Hex</span>
<span class="text-muted">A</span><span id="aB"></span><span id="aD"></span><span id="aH"></span>
<span class="text-muted">B</span><span id="bB"></span><span id="bD"></span><span id="bH"></span>
<span class="text-muted">Result</span><span id="rB"></span><span id="rD"></span><span id="rH"></span>
</div>
</div>
<div class="ad-zone">Ad Space — 336×280</div>
<div class="faq-section"><h2>FAQ</h2><div class="faq-item"><h3>What are bitwise operations?</h3><p>Bitwise operations work on individual bits: AND (&) returns 1 only when both bits are 1; OR (|) returns 1 when either bit is 1; XOR (^) returns 1 when bits differ; NOT (~) flips all bits.</p></div></div>
<div class="tool-card" style="max-width:720px;">
<h2 style="font-size:1rem;margin-bottom:0.75rem;">📖 About Binary Calculator</h2>
<p style="font-size:0.85rem;line-height:1.7;color:var(--text-muted);margin-bottom:0.75rem;">Binary Calculator is a free, browser-based tool built for students, professionals, and anyone who needs quick calculations. Perform binary arithmetic: add, subtract, multiply, divide, and bitwise operations (AND, OR, XOR, NOT). Step-by-step results. Free online binary calculator. This tool processes everything locally using JavaScript — no data is uploaded to any server, no account is required, and there are no usage limits. Whether you’re working on a quick project or handling sensitive data, your privacy is fully protected. Bookmark this page and use it anytime — it works on desktop, tablet, and mobile devices.</p>
<h3 style="font-size:0.9rem;margin-bottom:0.5rem;">How to Use</h3>
<ol style="font-size:0.85rem;color:var(--text-muted);line-height:1.7;padding-left:1.2rem;">
<li><strong>Enter your data</strong> — Type, paste, or upload your input in the fields above.</li>
<li><strong>Configure options</strong> — Adjust any settings or parameters to match your requirements.</li>
<li><strong>Get instant results</strong> — Output updates automatically in real-time as you type.</li>
<li><strong>Copy or download</strong> — Use the Copy button to grab results, or download if available.</li>
</ol>
</div>
<div class="related-tools"><h2>Related Tools</h2><div class="related-grid">
<a href="number-base.html"><span class="tool-icon">🔢</span> Number Base</a>
<a href="text-to-binary.html"><span class="tool-icon">🔢</span> Text to Binary</a>
<a href="percentage-calculator.html"><span class="tool-icon">🧮</span> Percentage Calculator</a>
<a href="chmod-calculator.html"><span class="tool-icon">🔧</span> Chmod Calculator</a>
</div></div>
<div class="ad-zone ad-zone-bottom">Ad Space — 728×90</div>
<footer class="site-footer"><p>© 2026 QuickTools.</p><div class="footer-links"><a href="index.html">All Tools</a><a href="#">Privacy</a></div></footer>
</div>
<script>
function calc(){
const aStr=document.getElementById('numA').value.replace(/[^01]/g,'');
const bStr=document.getElementById('numB').value.replace(/[^01]/g,'');
const op=document.getElementById('op').value;
const a=parseInt(aStr||'0',2),b=parseInt(bStr||'0',2);
let result;
switch(op){
case'+':result=a+b;break;case'-':result=a-b;break;case'*':result=a*b;break;
case'/':result=b?Math.floor(a/b):0;break;
case'&':result=a&b;break;case'|':result=a|b;break;case'^':result=a^b;break;
case'~':result=~a&0xFF;break;case'<<':result=a<<b;break;case'>>':result=a>>b;break;
default:result=0;
}
const abs=Math.abs(result);const sign=result<0?'-':'';
document.getElementById('resultBin').textContent=sign+(abs>>>0).toString(2);
document.getElementById('resultDec').textContent=result;
document.getElementById('resultHex').textContent='0x'+sign+abs.toString(16).toUpperCase();
document.getElementById('resultOct').textContent='0o'+sign+abs.toString(8);
// Table
document.getElementById('aB').textContent=a.toString(2);document.getElementById('aD').textContent=a;document.getElementById('aH').textContent='0x'+a.toString(16).toUpperCase();
document.getElementById('bB').textContent=b.toString(2);document.getElementById('bD').textContent=b;document.getElementById('bH').textContent='0x'+b.toString(16).toUpperCase();
document.getElementById('rB').textContent=(abs>>>0).toString(2);document.getElementById('rD').textContent=result;document.getElementById('rH').textContent='0x'+abs.toString(16).toUpperCase();
}
calc();
</script>
<script src="ads.js"></script>
</body>
</html>