-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase32-encoder-decoder.html
More file actions
335 lines (299 loc) · 15.6 KB
/
Copy pathbase32-encoder-decoder.html
File metadata and controls
335 lines (299 loc) · 15.6 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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1981515451878575" crossorigin="anonymous"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Base32 Encoder & Decoder | Free Online Base32 Tool</title>
<meta name="description" content="Encode and decode Base32 strings instantly. Free online Base32 decoder and encoder for developers, running securely offline in your browser.">
<link rel="canonical" href="https://quickdevbox.com/base32-encoder-decoder">
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css?v=2.2">
<!-- Complete OpenGraph & Social Preview Tags -->
<meta property="og:title" content="Online Base32 Encoder & Decoder - QuickDevBox">
<meta property="og:description" content="Free online Base32 encoder and decoder. Convert strings into RFC 4648 Base32 format client-side for 2FA TOTP secret keys and tokens.">
<meta property="og:url" content="https://quickdevbox.com/base32-encoder-decoder">
<meta property="og:type" content="website">
<meta property="og:image" content="https://quickdevbox.com/og-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Online Base32 Encoder & Decoder - QuickDevBox">
<meta name="twitter:description" content="Free online Base32 encoder and decoder. Convert strings into RFC 4648 Base32 format client-side for 2FA TOTP secret keys and tokens.">
<meta name="twitter:image" content="https://quickdevbox.com/og-image.png">
<!-- Search Robots Directive -->
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Online Base32 Encoder & Decoder",
"description": "Free online Base32 encoder and decoder. Convert strings into RFC 4648 Base32 format client-side for 2FA TOTP secret keys and tokens.",
"url": "https://quickdevbox.com/base32-encoder-decoder",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "All",
"browserRequirements": "Requires JavaScript. Requires HTML5.",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Organization",
"name": "QuickDevBox Tools",
"url": "https://quickdevbox.com"
}
}
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "Why is Base32 preferred over Base64 for Two-Factor Authentication (2FA) secrets?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Base32 is case-insensitive and omits ambiguous glyphs, making manual 2FA secret entry error-free."
}
},
{
"@type": "Question",
"name": "What is Crockford's Base32 alternative alphabet?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Crockford Base32 excludes I, L, O, and U to avoid optical character confusion and accidental words."
}
}
]
}
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-E0LZHPD7SL"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-E0LZHPD7SL');
</script>
</head>
<body>
<header>
<div class="nav-container">
<a href="/" class="logo">
<img src="favicon.svg" alt="QuickDevBox Logo">
QuickDevBox<span>.com</span>
</a>
<nav class="nav-links">
<a href="/">Home</a>
<a href="/json-formatter">JSON Tools</a>
<a href="/cron-expression-generator">Cron Generator</a>
<a href="/jwt-decoder">JWT Decoder</a>
<a href="/base64-encoder-decoder">Base64</a>
<a href="mailto:support@quickdevbox.com?subject=QuickDevBox%20Feedback" class="nav-support">✉️ Support</a>
</nav>
</div>
</header>
<main>
<section class="hero" style="padding: 0.5rem 0 0.8rem;">
<h1 style="font-size: 1.6rem; margin-bottom: 0.3rem;">Base32 Encoder & Decoder</h1>
<p style="font-size: 0.88rem;">Encode and decode text into RFC 4648 compliant Base32 representations for 2FA TOTP keys.</p>
</section>
<section class="tool-box">
<div class="privacy-banner">
<span>🛡️ <strong>100% Client-Side Processing:</strong> Secrets and strings are encoded locally without network requests.</span>
</div>
<div class="tool-controls">
<button class="btn btn-secondary" onclick="document.querySelectorAll('textarea, input[type=text], input[type=number]').forEach(el => el.value=''); if(typeof updateCounter==='function')updateCounter();" style="color:var(--danger); font-size:0.8rem; padding:0.4rem 0.8rem; margin-left:0.5rem;">🗑️ Clear</button>
<button data-ux="action-primary" class="btn" onclick="encodeBase32()">🔒 Encode Base32</button>
<button class="btn btn-secondary" onclick="decodeBase32()">🔓 Decode Base32</button>
<button class="btn btn-sample" onclick="loadSample()">💡 Fill Sample</button>
<button class="btn btn-secondary" onclick="copyResult()">📋 Copy Output</button>
</div>
<!-- AdSense Responsive Slot -->
<div class="ad-slot-header"></div>
<div class="editor-wrapper">
<div>
<div class="editor-header"><span class="editor-counter" id="editor-counter" style="float:right; font-size:0.8rem; margin-right:10px;">0 chars | 0 lines</span><span style="font-size:0.75rem; color:var(--text-muted); float:right; margin-top:4px;">(Ctrl+Enter)</span> Input Text / Base32 Secret</div>
<textarea data-ux="input" id="b32Input" rows="12" placeholder="Enter text to encode or Base32 string to decode... e.g. JBSWY3DPEHPK3PXP"></textarea>
</div>
<div>
<div class="editor-header"><span class="editor-counter" id="editor-counter-2" style="float:right; font-size:0.8rem; margin-right:10px;">0 chars | 0 lines</span><span style="font-size:0.75rem; color:var(--text-muted); float:right; margin-top:4px;">(Ctrl+Enter)</span> Output Result</div>
<textarea id="b32Output" rows="12" readonly placeholder="Result will appear here..."></textarea>
</div>
</div>
<div id="statusMsg" class="status-msg"></div>
</section>
<article class="seo-article">
<h2>Base32 Encoding: RFC 4648 5-bit Grouping, TOTP Keys & Crockford Standards</h2>
<p>Base32 encodes binary payloads into a 32-character case-insensitive ASCII alphabet using 5-bit grouping (2^5 = 32). It eliminates visually ambiguous characters (like 0, 1, 8, 9) and serves as the universal encoding standard for TOTP two-factor authentication secrets.</p>
<div class="tech-specs">
<div class="spec-card">
<strong>IETF Standard</strong>
<span>RFC 4648 §6 (The Base32 Alphabet: A-Z and 2-7)</span>
</div>
<div class="spec-card">
<strong>Bit Slicing</strong>
<span>5 input bytes (40 bits) map into 8 output characters (5 bits each)</span>
</div>
<div class="spec-card">
<strong>2FA Security Primitive</strong>
<span>Standard secret format for Google Authenticator & RFC 6238 TOTP</span>
</div>
<div class="spec-card">
<strong>Padding Character</strong>
<span>Equals sign (=) for byte lengths not divisible by 5</span>
</div>
</div>
<h3>Implementation & Code Examples</h3>
<h4>JavaScript Base32 Encoder</h4>
<pre><code>function base32Encode(buffer) {
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
let bits = 0, value = 0, output = '';
for (let i = 0; i < buffer.length; i++) {
value = (value << 8) | buffer[i];
bits += 8;
while (bits >= 5) {
output += alphabet[(value >>> (bits - 5)) & 31];
bits -= 5;
}
}
if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];
while (output.length % 8 !== 0) output += '=';
return output;
}</code></pre>
<h4>Python 3 (base64 module)</h4>
<pre><code>import base64
secret = b"TOTP_SECRET_KEY_123"
encoded = base64.b32encode(secret).decode('ascii')
decoded = base64.b32decode(encoded).decode('utf-8')
print("Base32 Key:", encoded)</code></pre>
<h3>Cryptographic Architecture & Production Security Considerations</h3>
<p>Deploying Base32 Encoding across cloud backends demands strict adherence to industry-standard defense-in-depth security principles:</p>
<ul>
<li><strong>Side-Channel Timing Resistance:</strong> Always evaluate cryptographic hashes, HMAC signatures, and authentication tokens using constant-time comparison algorithms (like <code>crypto.timingSafeEqual</code>) to eliminate microsecond side-channel timing leaks.</li>
<li><strong>Entropy Sourcing & Nonce Generation:</strong> Ensure all cryptographic nonces, initialization vectors, and salts are derived from cryptographically secure pseudo-random number generators (CSPRNG) like <code>window.crypto.getRandomValues</code> or <code>/dev/urandom</code>.</li>
<li><strong>Key Hygiene & Memory Deallocation:</strong> Zero out sensitive key buffers and decrypted payloads in memory immediately following transformation routines to limit memory dump exposure risks.</li>
</ul>
<section class="faq-section">
<h2>Frequently Asked Questions & Troubleshooting</h2>
<div class="faq-item">
<h3>Why is Base32 preferred over Base64 for Two-Factor Authentication (2FA) secrets?</h3>
<p>Base32 is strictly case-insensitive and avoids visually confusing characters like 0/O and 1/l. Users manually typing a secret into a mobile authenticator app make far fewer transcription errors.</p>
</div>
<div class="faq-item">
<h3>What is Crockford's Base32 alternative alphabet?</h3>
<p>Douglas Crockford designed an alternate Base32 variant using digits 0-9 and letters A-Z (excluding I, L, O, and U to prevent accidental profanity and font ambiguity), widely used for human-readable product serial keys.</p>
</div>
</section>
<h3>Official Standards & Technical References</h3>
<ul>
<li><a href="https://datatracker.ietf.org/doc/html/rfc4648#section-6" target="_blank" rel="noopener noreferrer">IETF RFC 4648 §6: Base32 Data Encoding</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc6238" target="_blank" rel="noopener noreferrer">IETF RFC 6238: TOTP: Time-Based One-Time Password Algorithm</a></li>
</ul>
</article>
<section class="related-tools">
<h3>Explore Related Developer Utilities</h3>
<div class="related-links">
<a href="/base64-encoder-decoder">🔑 Base64 Encoder</a>
<a href="/jwt-decoder">🛡️ JWT Decoder</a>
<a href="/hash-generator">⚡ SHA-256 Hash</a>
<a href="/timestamp-converter">⏳ Unix Timestamp</a>
<a href="/bcrypt-hash-generator">🔒 Bcrypt Generator</a>
</div>
</section>
</main>
<footer>
<div class="footer-container" style="max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--bg-card-border);">
<p>© 2026 QuickDevBox.com — Free, Open Source & Privacy-First Developer Tools</p>
<p style="margin-top: 0.5rem;">
<a href="/privacy-policy" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Privacy Policy</a> |
<a href="/terms" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Terms of Service</a> |
<a href="/about" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">About</a> |
<a href="https://github.com/hbx1982/quickdevbox" target="_blank" rel="noopener noreferrer" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">GitHub</a> |
<a href="mailto:support@quickdevbox.com?subject=QuickDevBox%20Feedback" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Contact Support</a>
</p>
</div>
</footer>
<script>
function showStatus(msg, isError = false) {
const el = document.getElementById('statusMsg');
el.style.display = 'block';
el.className = 'status-msg ' + (isError ? 'status-error' : 'status-success');
el.innerText = msg;
}
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
function loadSample() {
document.getElementById('b32Input').value = "JBSWY3DPEHPK3PXP";
decodeBase32();
}
function encodeBase32() {
const input = document.getElementById('b32Input').value;
if (!input) return;
let bin = "";
for (let i = 0; i < input.length; i++) {
bin += input.charCodeAt(i).toString(2).padStart(8, '0');
}
let res = "";
for (let i = 0; i < bin.length; i += 5) {
let chunk = bin.substring(i, i + 5);
if (chunk.length < 5) chunk = chunk.padEnd(5, '0');
res += alphabet[parseInt(chunk, 2)];
}
document.getElementById('b32Output').value = res;
showStatus("Text encoded to Base32 successfully!");
}
function decodeBase32() {
const input = document.getElementById('b32Input').value.trim().toUpperCase().replace(/=/g, '');
if (!input) return;
try {
let bin = "";
for (let i = 0; i < input.length; i++) {
const idx = alphabet.indexOf(input[i]);
if (idx === -1) throw new Error("Invalid character");
bin += idx.toString(2).padStart(5, '0');
}
let res = "";
for (let i = 0; i + 8 <= bin.length; i += 8) {
res += String.fromCharCode(parseInt(bin.substring(i, i + 8), 2));
}
document.getElementById('b32Output').value = res;
showStatus("Base32 decoded successfully!");
} catch (err) {
showStatus("Invalid Base32 sequence.", true);
}
}
function copyResult() {
const out = document.getElementById('b32Output').value;
if (!out) return;
navigator.clipboard.writeText(out);
showStatus("Result copied to clipboard!");
}
// Keyboard Shortcuts Support
document.addEventListener('keydown', function(e) {
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
e.preventDefault();
const primaryBtn = document.querySelector('[data-ux="action-primary"], .btn-primary, button[onclick^="process"], button[onclick^="generate"], button[onclick^="analyze"]');
if (primaryBtn) primaryBtn.click();
}
});
// Large File Safeguard
document.querySelectorAll('textarea').forEach(ta => {
ta.addEventListener('input', function(e) {
if (e.target.value.length > 2 * 1024 * 1024) {
if (typeof showStatus === 'function') {
showStatus("Input exceeds 2MB limit. To protect your browser from freezing, please use a smaller payload.", true);
} else {
alert("Input exceeds 2MB limit!");
}
e.target.value = e.target.value.substring(0, 2 * 1024 * 1024);
if (typeof updateCounter === 'function') updateCounter();
}
});
});
</script>
<script src="ux-enhancements.js?v=2.2"></script>
</body>
</html>