-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinary-converter.html
More file actions
299 lines (278 loc) Β· 15 KB
/
binary-converter.html
File metadata and controls
299 lines (278 loc) Β· 15 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://quge5.com/88/tag.min.js" data-zone="196361" async data-cfasync="false"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binary Converter - Binary to Decimal Hex Octal</title>
<meta name="description" content="Free binary converter. Convert between binary, decimal, hexadecimal, and octal. Easy number base conversions.">
<link rel="canonical" href="https://austron24.github.io/webaudit-tools/binary-converter.html">
<style>
:root { --primary: #6366f1; --primary-dark: #4f46e5; --secondary: #22d3ee; --accent: #f59e0b; --bg-dark: #0f172a; --bg-card: #1e293b; --bg-input: #334155; --text-primary: #f1f5f9; --text-secondary: #94a3b8; --border: #475569; --success: #10b981; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-dark); color: var(--text-primary); min-height: 100vh; line-height: 1.6; }
.header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 40px 20px; text-align: center; }
.header h1 { font-size: 2.5rem; margin-bottom: 10px; }
.main-container { max-width: 1200px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 1fr 160px; gap: 20px; }
.content-area { display: flex; flex-direction: column; gap: 20px; }
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--bg-card); border-radius: 16px; padding: 24px; }
.card h2 { color: var(--secondary); margin-bottom: 20px; font-size: 1.3rem; }
.converter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.input-group { background: var(--bg-input); padding: 20px; border-radius: 12px; }
.input-group h3 { color: var(--secondary); margin-bottom: 15px; display: flex; align-items: center; gap: 10px; }
.base-label { background: var(--primary); color: white; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; }
input { width: 100%; padding: 15px; border: 2px solid var(--border); border-radius: 8px; font-size: 1.1rem; font-family: monospace; background: var(--bg-dark); color: var(--text-primary); }
input:focus { outline: none; border-color: var(--primary); }
.copy-btn { display: block; width: 100%; padding: 10px; border: none; border-radius: 8px; background: var(--primary); color: white; cursor: pointer; font-weight: 600; margin-top: 10px; }
.quick-values { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.quick-btn { padding: 8px 16px; border: 2px solid var(--border); border-radius: 6px; background: var(--bg-input); color: var(--text-primary); cursor: pointer; font-family: monospace; }
.quick-btn:hover { border-color: var(--primary); }
.ascii-section { margin-top: 20px; }
.ascii-input { margin-top: 10px; }
.ascii-output { background: var(--bg-input); padding: 15px; border-radius: 8px; margin-top: 10px; font-family: monospace; word-break: break-all; }
.related-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 15px; }
.related-link { display: block; padding: 12px 16px; background: var(--bg-input); border-radius: 8px; color: var(--text-primary); text-decoration: none; }
.related-link:hover { background: var(--primary); }
@media (max-width: 968px) { .main-container { grid-template-columns: 1fr; } .sidebar { display: none; } }
@media (max-width: 640px) { .converter-grid { grid-template-columns: 1fr; } }
.faq-section { margin-top: 20px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--bg-input); border-radius: 10px; overflow: hidden; }
.faq-question { padding: 15px 20px; cursor: pointer; font-weight: 600; color: var(--text-primary); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after { content: '+'; font-size: 1.5rem; color: var(--primary); transition: transform 0.3s; }
details[open] .faq-question::after { content: 'β'; }
.faq-answer { padding: 0 20px 15px; color: var(--text-secondary); line-height: 1.7; }
details[open] { background: var(--bg-input); border-left: 3px solid var(--primary); }
.breadcrumb { padding: 15px 20px; background: var(--bg-card); margin-bottom: 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; max-width: 1200px; margin: 0 auto; padding: 0; }
.breadcrumb li { display: flex; align-items: center; font-size: 14px; color: var(--text-secondary); }
.breadcrumb li:not(:last-child)::after { content: 'βΊ'; margin-left: 8px; color: var(--text-secondary); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb li:last-child { color: var(--text-primary); }
</style>
<script>(function(s){s.dataset.zone='10379224',s.src='https://nap5k.com/tag.min.js'})([document.documentElement, document.body].filter(Boolean).pop().appendChild(document.createElement('script')))</script>
<!-- SEO Optimization -->
<meta property="og:title" content="Binary Converter - Free Online Tool">
<meta property="og:description" content="Free binary converter. Convert between binary, decimal, hexadecimal, and octal. Easy number base conversions.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://austron24.github.io/webaudit-tools/binary-converter.html">
<meta property="og:site_name" content="WebAudit Tools">
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Binary Converter - Free Online Tool">
<meta name="twitter:description" content="Free binary converter. Convert between binary, decimal, hexadecimal, and octal. Easy number base conversions.">
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large">
<meta name="author" content="WebAudit Tools">
<meta name="rating" content="general">
<meta name="distribution" content="global">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Binary Converter",
"url": "https://austron24.github.io/webaudit-tools/binary-converter.html",
"description": "Free binary converter. Convert between binary, decimal, hexadecimal, and octal. Easy number base conversions.",
"applicationCategory": "Developer Tools",
"operatingSystem": "Any",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"browserRequirements": "Requires JavaScript",
"softwareVersion": "1.0",
"author": {
"@type": "Organization",
"name": "WebAudit Tools"
}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://austron24.github.io/webaudit-tools/"
},
{
"@type": "ListItem",
"position": 2,
"name": "Math Calculators",
"item": "https://austron24.github.io/webaudit-tools/#math"
},
{
"@type": "ListItem",
"position": 3,
"name": "Binary Converter - Binary to Decimal Hex Octal",
"item": "https://austron24.github.io/webaudit-tools/binary-converter.html"
}
]
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "HowTo",
"name": "How to Use the Binary Converter - Binary to Decimal Hex Octal",
"description": "Step-by-step guide to using our free online Binary Converter - Binary to Decimal Hex Octal",
"step": [
{
"@type": "HowToStep",
"position": 1,
"name": "Enter Your Values",
"text": "Fill in the input fields with your specific numbers or values."
},
{
"@type": "HowToStep",
"position": 2,
"name": "View Results",
"text": "Results calculate automatically as you type - no submit button needed."
},
{
"@type": "HowToStep",
"position": 3,
"name": "Adjust as Needed",
"text": "Modify any input to instantly see how changes affect your results."
}
],
"totalTime": "PT1M"
}
</script>
<!-- End SEO Optimization -->
</head>
<body>
</div>
</div>
<header class="header">
<h1>01 Binary Converter</h1>
</header>
<div class="main-container">
<div class="content-area">
<div class="card">
<h2>π’ Number Base Converter</h2>
<div class="converter-grid">
<div class="input-group">
<h3>Binary <span class="base-label">Base 2</span></h3>
<input type="text" id="binary" placeholder="01101010" oninput="convert('binary')">
<button class="copy-btn" onclick="copy('binary')">π Copy</button>
</div>
<div class="input-group">
<h3>Decimal <span class="base-label">Base 10</span></h3>
<input type="text" id="decimal" placeholder="106" oninput="convert('decimal')">
<button class="copy-btn" onclick="copy('decimal')">π Copy</button>
</div>
<div class="input-group">
<h3>Hexadecimal <span class="base-label">Base 16</span></h3>
<input type="text" id="hex" placeholder="6A" oninput="convert('hex')">
<button class="copy-btn" onclick="copy('hex')">π Copy</button>
</div>
<div class="input-group">
<h3>Octal <span class="base-label">Base 8</span></h3>
<input type="text" id="octal" placeholder="152" oninput="convert('octal')">
<button class="copy-btn" onclick="copy('octal')">π Copy</button>
</div>
</div>
<div class="quick-values">
<span style="color: var(--text-secondary);">Quick values:</span>
<button class="quick-btn" onclick="setDecimal(0)">0</button>
<button class="quick-btn" onclick="setDecimal(1)">1</button>
<button class="quick-btn" onclick="setDecimal(8)">8</button>
<button class="quick-btn" onclick="setDecimal(16)">16</button>
<button class="quick-btn" onclick="setDecimal(32)">32</button>
<button class="quick-btn" onclick="setDecimal(64)">64</button>
<button class="quick-btn" onclick="setDecimal(128)">128</button>
<button class="quick-btn" onclick="setDecimal(255)">255</button>
<button class="quick-btn" onclick="setDecimal(256)">256</button>
<button class="quick-btn" onclick="setDecimal(1024)">1024</button>
</div>
</div>
<div class="card">
<h2>π Text to Binary</h2>
<div class="ascii-section">
<div class="form-group">
<label style="color: var(--text-secondary);">Enter text to convert to binary</label>
<input type="text" id="textInput" class="ascii-input" placeholder="Hello" oninput="textToBinary()">
</div>
<div class="ascii-output" id="binaryOutput">Binary output will appear here...</div>
<button class="copy-btn" onclick="copyBinaryText()" style="margin-top: 10px;">π Copy Binary</button>
</div>
</div>
</div>
<div class="card">
<h2>π Related Tools</h2>
<div class="related-tools">
<a href="hex-to-rgb-converter.html" class="related-link">π¨ Hex to RGB</a>
<a href="base64-encoder.html" class="related-link">π€ Base64 Encoder</a>
<a href="hash-generator.html" class="related-link">π Hash Generator</a>
<a href="ascii-table.html" class="related-link">π ASCII Table</a>
</div>
</div>
</div>
<div class="sidebar">
</div>
</div>
</div>
<script>
function convert(from) {
let decimal;
try {
switch(from) {
case 'binary':
decimal = parseInt(document.getElementById('binary').value, 2);
break;
case 'decimal':
decimal = parseInt(document.getElementById('decimal').value, 10);
break;
case 'hex':
decimal = parseInt(document.getElementById('hex').value, 16);
break;
case 'octal':
decimal = parseInt(document.getElementById('octal').value, 8);
break;
}
if (isNaN(decimal)) {
clearAll();
return;
}
if (from !== 'binary') document.getElementById('binary').value = decimal.toString(2);
if (from !== 'decimal') document.getElementById('decimal').value = decimal.toString(10);
if (from !== 'hex') document.getElementById('hex').value = decimal.toString(16).toUpperCase();
if (from !== 'octal') document.getElementById('octal').value = decimal.toString(8);
} catch(e) {
// Invalid input
}
}
function clearAll() {
document.getElementById('binary').value = '';
document.getElementById('decimal').value = '';
document.getElementById('hex').value = '';
document.getElementById('octal').value = '';
}
function setDecimal(value) {
document.getElementById('decimal').value = value;
convert('decimal');
}
function copy(id) {
navigator.clipboard.writeText(document.getElementById(id).value);
}
function textToBinary() {
const text = document.getElementById('textInput').value;
const binary = text.split('').map(char =>
char.charCodeAt(0).toString(2).padStart(8, '0')
).join(' ');
document.getElementById('binaryOutput').textContent = binary || 'Binary output will appear here...';
}
function copyBinaryText() {
navigator.clipboard.writeText(document.getElementById('binaryOutput').textContent);
}
setDecimal(42);
</script>
</body>
</html>