-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase64.html
More file actions
233 lines (211 loc) · 12.2 KB
/
base64.html
File metadata and controls
233 lines (211 loc) · 12.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Free Base64 Encoder & Decoder — Encode, Decode, File Support</title>
<meta name="description" content="Encode and decode Base64 strings instantly. Supports text and file encoding. Free online Base64 tool — no signup required.">
<link rel="canonical" href="https://www.quicktools.mom/base64.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/base64.html">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="style.css">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Free Base64 Encoder Decoder",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Web",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }
}
</script>
<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":"📁 File to Base64","acceptedAnswer":{"@type":"Answer","text":"Drag and drop or click to select a file. The file will be converted to a Base64 data URI."}},{"@type":"Question","name":"What is Base64 encoding?","acceptedAnswer":{"@type":"Answer","text":"Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 ASCII characters. It's commonly used to embed images in HTML/CSS, transmit binary data in JSON/XML, and encode email attachments."}},{"@type":"Question","name":"Does Base64 increase file size?","acceptedAnswer":{"@type":"Answer","text":"Yes. Base64 encoding increases the data size by approximately 33%. This is because every 3 bytes of binary data are represented as 4 Base64 characters."}},{"@type":"Question","name":"Is Base64 encryption?","acceptedAnswer":{"@type":"Answer","text":"No. Base64 is an encoding scheme, not encryption. It does not provide any security — anyone can decode Base64 data. For security, use proper encryption algorithms."}}]}</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">🔄 Encoding</div>
<h1>Base64 Encoder & Decoder</h1>
<p>Encode text to Base64 or decode Base64 strings instantly. Supports UTF-8 and file encoding.</p>
</div>
<div class="tool-card">
<label>Input</label>
<textarea id="inputText" class="mono" rows="6" placeholder="Enter text to encode, or Base64 string to decode..." oninput="autoProcess()"></textarea>
<div class="btn-group">
<button class="btn btn-primary" onclick="encode()" id="encodeBtn">🔒 Encode to Base64</button>
<button class="btn btn-secondary" onclick="decode()" id="decodeBtn">🔓 Decode from Base64</button>
<button class="btn btn-secondary" onclick="swapFields()">🔃 Swap</button>
</div>
<div class="output-area mt-3">
<span class="output-label">Output</span>
<pre id="outputText" style="min-height: 60px; word-break: break-all;">Results will appear here...</pre>
<button class="copy-btn" onclick="copyOutput()">Copy</button>
</div>
<div class="stats-bar">
<div class="stat-item">
<span class="stat-value" id="inputSize">0 B</span>
<span class="stat-label">Input Size</span>
</div>
<div class="stat-item">
<span class="stat-value" id="outputSize">0 B</span>
<span class="stat-label">Output Size</span>
</div>
<div class="stat-item">
<span class="stat-value" id="ratio">—</span>
<span class="stat-label">Size Ratio</span>
</div>
</div>
</div>
<div class="tool-card">
<h3 style="font-size: 0.95rem; margin-bottom: 1rem;">📁 File to Base64</h3>
<p class="text-muted mb-2" style="font-size: 0.85rem;">Drag and drop or click to select a file. The file will be converted to a Base64 data URI.</p>
<div id="dropZone" style="border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; cursor: pointer; transition: var(--transition);"
onclick="document.getElementById('fileInput').click()"
ondragover="event.preventDefault(); this.style.borderColor='var(--accent)'"
ondragleave="this.style.borderColor='var(--border)'"
ondrop="handleDrop(event)">
<input type="file" id="fileInput" style="display: none" onchange="handleFile(this.files[0])">
<span style="font-size: 2rem;">📄</span>
<p class="mt-1 text-muted" style="font-size: 0.85rem;">Drop a file here or click to browse</p>
</div>
<div class="output-area mt-2 hidden" id="fileOutput">
<span class="output-label">File as Base64</span>
<pre id="fileBase64" style="max-height: 200px; overflow-y: auto; word-break: break-all;"></pre>
<button class="copy-btn" onclick="copyFileB64()">Copy</button>
</div>
</div>
<div class="ad-zone">Ad Space — 336×280</div>
<div class="faq-section">
<h2> <div class="tool-card" style="max-width:720px;">
<h2 style="font-size:1rem;margin-bottom:0.75rem;">📖 About Base64 Encoder & Decoder</h2>
<p style="font-size:0.85rem;line-height:1.7;color:var(--text-muted);margin-bottom:0.75rem;">Base64 Encoder & Decoder is a free, browser-based tool built for developers and security professionals. Encode and decode Base64 strings instantly. Supports text and file encoding. Free online Base64 tool — no signup required. 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>
Frequently Asked Questions</h2>
<div class="faq-item">
<h3>What is Base64 encoding?</h3>
<p>Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 ASCII characters. It's commonly used to embed images in HTML/CSS, transmit binary data in JSON/XML, and encode email attachments.</p>
</div>
<div class="faq-item">
<h3>Does Base64 increase file size?</h3>
<p>Yes. Base64 encoding increases the data size by approximately 33%. This is because every 3 bytes of binary data are represented as 4 Base64 characters.</p>
</div>
<div class="faq-item">
<h3>Is Base64 encryption?</h3>
<p>No. Base64 is an encoding scheme, not encryption. It does not provide any security — anyone can decode Base64 data. For security, use proper encryption algorithms.</p>
</div>
</div>
<div class="related-tools">
<h2>Related Tools</h2>
<div class="related-grid">
<a href="json-formatter.html"><span class="tool-icon">{ }</span> JSON Formatter</a>
<a href="uuid-generator.html"><span class="tool-icon">🆔</span> UUID Generator</a>
<a href="password-generator.html"><span class="tool-icon">🔐</span> Password Generator</a>
<a href="color-converter.html"><span class="tool-icon">🎨</span> Color Converter</a>
</div>
</div>
<div class="ad-zone ad-zone-bottom">Ad Space — 728×90</div>
<footer class="site-footer">
<p>© 2026 QuickTools. All tools are free and open.</p>
<div class="footer-links"><a href="index.html">All Tools</a><a href="#">Privacy</a></div>
</footer>
</div>
<script>
function formatSize(bytes) {
if (bytes < 1024) return bytes + ' B';
if (bytes < 1024*1024) return (bytes/1024).toFixed(1) + ' KB';
return (bytes/1024/1024).toFixed(1) + ' MB';
}
function updateStats(inputStr, outputStr) {
const inSize = new Blob([inputStr]).size;
const outSize = new Blob([outputStr]).size;
document.getElementById('inputSize').textContent = formatSize(inSize);
document.getElementById('outputSize').textContent = formatSize(outSize);
document.getElementById('ratio').textContent = inSize > 0 ? (outSize / inSize * 100).toFixed(0) + '%' : '—';
}
function encode() {
const input = document.getElementById('inputText').value;
try {
const encoded = btoa(unescape(encodeURIComponent(input)));
document.getElementById('outputText').textContent = encoded;
updateStats(input, encoded);
} catch(e) {
document.getElementById('outputText').textContent = 'Error: ' + e.message;
}
}
function decode() {
const input = document.getElementById('inputText').value.trim();
try {
const decoded = decodeURIComponent(escape(atob(input)));
document.getElementById('outputText').textContent = decoded;
updateStats(input, decoded);
} catch(e) {
document.getElementById('outputText').textContent = 'Error: Invalid Base64 string — ' + e.message;
}
}
function autoProcess() {
const input = document.getElementById('inputText').value.trim();
if (/^[A-Za-z0-9+/=]+$/.test(input) && input.length > 8 && input.length % 4 === 0) {
document.getElementById('decodeBtn').style.boxShadow = '0 0 0 2px var(--accent)';
document.getElementById('encodeBtn').style.boxShadow = 'none';
} else {
document.getElementById('encodeBtn').style.boxShadow = '0 0 0 2px var(--accent)';
document.getElementById('decodeBtn').style.boxShadow = 'none';
}
}
function swapFields() {
const output = document.getElementById('outputText').textContent;
if (output && output !== 'Results will appear here...') {
document.getElementById('inputText').value = output;
autoProcess();
}
}
function copyOutput() {
const text = document.getElementById('outputText').textContent;
navigator.clipboard.writeText(text).then(() => {
const btn = document.querySelector('.output-area .copy-btn');
btn.textContent = 'Copied!'; btn.classList.add('copied');
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);
});
}
function handleDrop(e) {
e.preventDefault();
e.currentTarget.style.borderColor = 'var(--border)';
if (e.dataTransfer.files.length) handleFile(e.dataTransfer.files[0]);
}
function handleFile(file) {
if (!file) return;
const reader = new FileReader();
reader.onload = () => {
document.getElementById('fileBase64').textContent = reader.result;
document.getElementById('fileOutput').classList.remove('hidden');
};
reader.readAsDataURL(file);
}
function copyFileB64() {
const text = document.getElementById('fileBase64').textContent;
navigator.clipboard.writeText(text).then(() => {
const btn = document.querySelector('#fileOutput .copy-btn');
btn.textContent = 'Copied!'; btn.classList.add('copied');
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);
});
}
</script>
<script src="ads.js"></script>
</body>
</html>