{"id":535,"date":"2026-03-12T13:59:14","date_gmt":"2026-03-12T13:59:14","guid":{"rendered":"https:\/\/primetoolhub.com\/?page_id=535"},"modified":"2026-11-10T12:56:01","modified_gmt":"2026-11-10T12:56:01","slug":"free-base64-encoder-decoder-utf-8-supported","status":"publish","type":"page","link":"https:\/\/schoolict.net\/tools\/free-base64-encoder-decoder-utf-8-supported\/","title":{"rendered":"Free Base64 Encoder Decoder &amp; Image Converter"},"content":{"rendered":"\n<div class=\"pth-hero-section\">\n    <div class=\"pth-hero-content\">\n        <h2>Free Base64 Encoder, Decoder &amp; Image Converter<\/h2>\n        <p>The ultimate offline Base64 utility. Instantly encode\/decode text with UTF-8 support, convert images to Base64 strings, or decode Base64 back to images. 100% free and secure.<\/p>\n\n        <div id=\"pth-toc-placeholder\"><\/div>\n    <\/div>\n\n   \n<div class=\"pth-hero-image\">\n\t<img data-no-lazy=\"1\"\n         src=\"https:\/\/schoolict.net\/tools\/wp-content\/uploads\/2026\/07\/base64-encoder-decoder-800x447.jpeg\"\n         width=\"800\"\n         height=\"447\"\n         alt=\"base64 encoder decoder\"\n         fetchpriority=\"high\"\n         loading=\"eager\"\n         decoding=\"async\"\n         style=\"width:100%; height:auto; display:block;\">\n  <\/div>\n<\/div>\n\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#\ud83d\udd34-why-a-basic-base-64-encoder-is-not-enough\">\ud83d\udd34 Why a Basic Base64 Encoder Is Not Enough<\/a><ul><li><a href=\"#tab-1-\ud83d\udcdd-encode-utf-8-safe-with-live-mode\">Tab 1 \u2014 \ud83d\udcdd Encode: UTF-8 Safe with Live Mode<\/a><\/li><li><a href=\"#tab-2-\ud83d\udd13-decode-auto-normalization-before-decoding\">Tab 2 \u2014 \ud83d\udd13 Decode: Auto-Normalization Before Decoding<\/a><\/li><li><a href=\"#\ud83d\udfe1-tab-3-\ud83d\uddbc\ufe0f-image-encode-and-preview-side-by-side\">\ud83d\udfe1 Tab 3 \u2014 \ud83d\uddbc\ufe0f Image: Encode and Preview Side by Side<\/a><\/li><li><a href=\"#tab-4-\ud83d\udcc1-file-encoder-any-file-type\">Tab 4 \u2014 \ud83d\udcc1 File Encoder: Any File Type<\/a><\/li><li><a href=\"#tab-5-\u26a1-batch-multiple-items-one-click\">Tab 5 \u2014 \u26a1 Batch: Multiple Items, One Click<\/a><\/li><li><a href=\"#\ud83d\udfe2-tab-6-\ud83c\udfa8-css-html-generator-four-code-snippets\">\ud83d\udfe2 Tab 6 \u2014 \ud83c\udfa8 CSS\/HTML Generator: Four Code Snippets<\/a><\/li><li><a href=\"#tab-7-\ud83d\udcca-diff-compare-two-base-64-strings\">Tab 7 \u2014 \ud83d\udcca Diff: Compare Two Base64 Strings<\/a><\/li><li><a href=\"#tab-8-\ud83d\udd0d-inspector-decode-any-unknown-base-64\">Tab 8 \u2014 \ud83d\udd0d Inspector: Decode Any Unknown Base64<\/a><\/li><\/ul><\/li><li><a href=\"#\ud83d\udd34-connected-workflows-between-tabs\">\ud83d\udd34 Connected Workflows Between Tabs<\/a><\/li><\/ul><\/nav><\/div>\n\n\n<style>\r\n\/* ============================================================\r\n   PTH ALL-IN-ONE BASE64 & ENCODING STUDIO \u2014 v3.0 PRO\r\n   Text \u00b7 Image \u00b7 File \u00b7 Batch \u00b7 CSS\/HTML \u00b7 Diff \u00b7 Inspector\r\n   PTH v3.0 Compliant \u00b7 WCAG 2.1 AA \u00b7 100% Offline\r\n   ============================================================ *\/\r\n#pth-b64-wrapper{font-family:'Inter',system-ui,sans-serif;max-width:1500px;margin:0 auto;box-sizing:border-box;background:#f1f5f9;padding:24px;border-radius:20px;color:#1e293b;position:relative}\r\n#pth-b64-wrapper *{box-sizing:border-box;min-width:0}\r\n\/* Dark *\/\r\n#pth-b64-wrapper.pth-dark{background:#0f172a;color:#e2e8f0}\r\n#pth-b64-wrapper.pth-dark .pth-card{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-top-bar{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-tab-bar{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-tab-btn{color:#94a3b8}\r\n#pth-b64-wrapper.pth-dark .pth-tab-btn.active{background:#0f172a;color:#e2e8f0;border-bottom-color:#0f172a}\r\n#pth-b64-wrapper.pth-dark .pth-tab-wrap{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-editor{background:#0f172a;color:#a5f3fc;border-color:#475569}\r\n#pth-b64-wrapper.pth-dark .pth-editor-out{background:#0c2a1e;color:#a7f3d0;border-color:#34d399}\r\n#pth-b64-wrapper.pth-dark .pth-input{background:#0f172a;color:#e2e8f0;border-color:#475569}\r\n#pth-b64-wrapper.pth-dark .pth-select{background:#0f172a;color:#e2e8f0;border-color:#475569}\r\n#pth-b64-wrapper.pth-dark .pth-drop-zone{background:#0f172a;border-color:#475569}\r\n#pth-b64-wrapper.pth-dark .pth-drop-zone:hover{background:#1e293b;border-color:#3b82f6}\r\n#pth-b64-wrapper.pth-dark .pth-drop-zone.dragover{background:#1e3a5f;border-color:#3b82f6}\r\n#pth-b64-wrapper.pth-dark .pth-img-preview-wrap{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-stat-chip{background:#263548;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-history-item{background:#263548;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-sidebar-card{background:#1e293b;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-option-chip{background:#263548;border-color:#334155;color:#94a3b8}\r\n#pth-b64-wrapper.pth-dark .pth-option-chip.active{background:rgba(59,130,246,.2);border-color:#3b82f6;color:#93c5fd}\r\n#pth-b64-wrapper.pth-dark .pth-batch-row{background:#263548;border-color:#334155}\r\n#pth-b64-wrapper.pth-dark .pth-diff-add{background:rgba(16,185,129,.15);border-color:#6ee7b7}\r\n#pth-b64-wrapper.pth-dark .pth-diff-rem{background:rgba(220,38,38,.15);border-color:#fca5a5}\r\n#pth-b64-wrapper.pth-dark .pth-code-out{background:#0f172a;border-color:#475569;color:#a5f3fc}\r\n#pth-b64-wrapper.pth-dark .pth-inspect-row{background:#263548;border-color:#334155}\r\n\/* Top Bar *\/\r\n#pth-b64-wrapper .pth-top-bar{background:#fff;border:1px solid #e2e8f0;padding:18px 24px;border-radius:14px;display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;box-shadow:0 2px 8px rgba(0,0,0,.06);flex-wrap:wrap;gap:12px}\r\n#pth-b64-wrapper .pth-tool-title{font-size:1.45rem;font-weight:900;color:#0f172a;margin:0;display:flex;align-items:center;gap:10px;flex-wrap:wrap}\r\n#pth-b64-wrapper .pth-subtitle{font-size:.82rem;color:#334155;font-weight:600;margin-top:3px;display:block}\r\n#pth-b64-wrapper .pth-version-badge{font-size:.68rem;background:linear-gradient(135deg,#3b82f6,#1d4ed8);color:#fff;padding:3px 10px;border-radius:999px;font-weight:800}\r\n#pth-b64-wrapper .pth-status-offline{font-size:.68rem;background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0;padding:2px 8px;border-radius:4px;font-weight:700}\r\n#pth-b64-wrapper .pth-top-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}\r\n\/* Layout *\/\r\n#pth-b64-wrapper .pth-layout{display:grid;grid-template-columns:1fr 280px;gap:20px;align-items:start}\r\n#pth-b64-wrapper .pth-layout.pth-fw{grid-template-columns:1fr}\r\n#pth-b64-wrapper .pth-layout.pth-fw .pth-sidebar-col{display:none}\r\n@media(max-width:1100px){#pth-b64-wrapper .pth-layout{grid-template-columns:1fr}}\r\n\/* Card *\/\r\n#pth-b64-wrapper .pth-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:18px;margin-bottom:14px;box-shadow:0 2px 6px rgba(0,0,0,.04)}\r\n\/* Tabs *\/\r\n#pth-b64-wrapper .pth-tab-bar{display:flex;background:#fff;border:1px solid #e2e8f0;border-radius:12px 12px 0 0;overflow-x:auto;border-bottom:none;padding:4px 4px 0;gap:2px}\r\n#pth-b64-wrapper .pth-tab-btn{padding:8px 12px;font-size:.75rem;font-weight:800;color:#334155;background:transparent;border:1px solid transparent;border-bottom:none;border-radius:8px 8px 0 0;cursor:pointer;white-space:nowrap;transition:.15s;font-family:'Inter',sans-serif}\r\n#pth-b64-wrapper .pth-tab-btn:hover{background:#f8fafc;color:#0f172a}\r\n#pth-b64-wrapper .pth-tab-btn.active{background:#fff;color:#2563eb;border-color:#e2e8f0;border-bottom-color:#fff;font-weight:900;position:relative;bottom:-1px}\r\n#pth-b64-wrapper .pth-tab-wrap{background:#fff;border:1px solid #e2e8f0;border-radius:0 0 12px 12px;padding:18px;min-height:420px}\r\n#pth-b64-wrapper .pth-tab-panel{display:none}\r\n#pth-b64-wrapper .pth-tab-panel.active{display:block}\r\n\/* Buttons *\/\r\n#pth-b64-wrapper .pth-btn{padding:9px 17px;border-radius:8px;font-weight:800;font-size:.84rem;cursor:pointer;transition:all .2s;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:none;font-family:'Inter',sans-serif;white-space:nowrap}\r\n#pth-b64-wrapper .pth-btn-primary{background:#2563eb;color:#fff}\r\n#pth-b64-wrapper .pth-btn-primary:hover{background:#1d4ed8;transform:translateY(-1px)}\r\n#pth-b64-wrapper .pth-btn-success{background:linear-gradient(135deg,#10b981,#047857);color:#fff}\r\n#pth-b64-wrapper .pth-btn-success:hover{transform:translateY(-1px)}\r\n#pth-b64-wrapper .pth-btn-warning{background:#f59e0b;color:#fff}\r\n#pth-b64-wrapper .pth-btn-danger{background:#dc2626;color:#fff}\r\n#pth-b64-wrapper .pth-btn-secondary{background:#f1f5f9;color:#1e293b;border:1.5px solid #e2e8f0}\r\n#pth-b64-wrapper .pth-btn-secondary:hover{background:#e2e8f0}\r\n#pth-b64-wrapper .pth-btn-purple{background:#8b5cf6;color:#fff}\r\n#pth-b64-wrapper .pth-btn-purple:hover{background:#7c3aed}\r\n#pth-b64-wrapper .pth-btn-sm{padding:6px 12px;font-size:.76rem;border-radius:7px}\r\n#pth-b64-wrapper .pth-sample-btn{background:#ecfdf5;color:#047857;border:1px solid #6ee7b7;font-size:.75rem;padding:4px 10px;border-radius:6px;font-weight:700;cursor:pointer;transition:.2s}\r\n#pth-b64-wrapper .pth-sample-btn:hover{background:#d1fae5}\r\n\/* Forms *\/\r\n#pth-b64-wrapper .pth-label{font-size:.72rem;font-weight:800;color:#334155;margin-bottom:5px;display:block;text-transform:uppercase;letter-spacing:.5px}\r\n#pth-b64-wrapper .pth-editor{width:100%;padding:12px 14px;border:1.5px solid #cbd5e1;border-radius:10px;font-size:.82rem;background:#f8fafc;font-family:'Courier New',monospace;color:#1e293b;outline:none;resize:vertical;line-height:1.65;transition:.2s;word-break:break-all}\r\n#pth-b64-wrapper .pth-editor:focus{border-color:#3b82f6;background:#fff;box-shadow:0 0 0 3px rgba(59,130,246,.1)}\r\n#pth-b64-wrapper .pth-editor-out{background:#f0fdf4;border-color:#6ee7b7;color:#065f46}\r\n#pth-b64-wrapper .pth-input{width:100%;padding:9px 12px;border:1.5px solid #cbd5e1;border-radius:8px;font-size:.86rem;outline:none;transition:.2s;font-family:'Inter',sans-serif;color:#1e293b;background:#fff}\r\n#pth-b64-wrapper .pth-input:focus{border-color:#3b82f6}\r\n#pth-b64-wrapper .pth-select{width:100%;padding:9px 12px;border:1.5px solid #cbd5e1;border-radius:8px;font-size:.86rem;outline:none;font-family:'Inter',sans-serif;color:#1e293b;background:#fff;cursor:pointer}\r\n#pth-b64-wrapper .pth-row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-start;margin-bottom:12px}\r\n#pth-b64-wrapper .pth-col{flex:1;min-width:200px}\r\n#pth-b64-wrapper .pth-editor-grid{display:grid;grid-template-columns:1fr auto 1fr;gap:12px;align-items:start}\r\n@media(max-width:700px){#pth-b64-wrapper .pth-editor-grid{grid-template-columns:1fr}}\r\n\/* Option Chips *\/\r\n#pth-b64-wrapper .pth-option-chip{display:inline-flex;align-items:center;gap:5px;background:#f8fafc;border:1.5px solid #e2e8f0;border-radius:7px;padding:5px 10px;font-size:.78rem;font-weight:700;color:#334155;cursor:pointer;transition:.2s;user-select:none;font-family:'Inter',sans-serif}\r\n#pth-b64-wrapper .pth-option-chip input{display:none}\r\n#pth-b64-wrapper .pth-option-chip.active{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}\r\n#pth-b64-wrapper .pth-chips-row{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:12px}\r\n\/* Drop Zone *\/\r\n#pth-b64-wrapper .pth-drop-zone{border:2px dashed #cbd5e1;border-radius:12px;padding:32px 20px;text-align:center;cursor:pointer;transition:.3s;background:#f8fafc}\r\n#pth-b64-wrapper .pth-drop-zone:hover,#pth-b64-wrapper .pth-drop-zone.dragover{border-color:#3b82f6;background:#eff6ff}\r\n#pth-b64-wrapper .pth-drop-icon{font-size:2.2rem;margin-bottom:8px;display:block}\r\n\/* Image preview *\/\r\n#pth-b64-wrapper .pth-img-preview-wrap{display:none;text-align:center;padding:14px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;margin-top:10px}\r\n#pth-b64-wrapper .pth-img-preview{max-width:100%;max-height:240px;border-radius:8px;box-shadow:0 4px 6px rgba(0,0,0,.1);object-fit:contain}\r\n#pth-b64-wrapper .pth-img-meta{font-size:.72rem;font-weight:600;color:#334155;margin-top:8px;font-family:'Courier New',monospace}\r\n\/* Stats *\/\r\n#pth-b64-wrapper .pth-stats-row{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}\r\n#pth-b64-wrapper .pth-stat-chip{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:8px 12px;text-align:center;min-width:80px}\r\n#pth-b64-wrapper .pth-stat-val{font-size:1.1rem;font-weight:900;color:#1d4ed8;display:block}\r\n#pth-b64-wrapper .pth-stat-lbl{font-size:.62rem;color:#334155;font-weight:700;text-transform:uppercase}\r\n\/* Batch *\/\r\n#pth-b64-wrapper .pth-batch-row{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:9px 12px;margin-bottom:6px;display:flex;align-items:center;gap:10px;font-size:.78rem}\r\n#pth-b64-wrapper .pth-batch-input-txt{font-family:'Courier New',monospace;font-size:.75rem;color:#334155;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\r\n#pth-b64-wrapper .pth-batch-output-txt{font-family:'Courier New',monospace;font-size:.75rem;color:#1d4ed8;flex:2;word-break:break-all}\r\n\/* CSS\/HTML Code output *\/\r\n#pth-b64-wrapper .pth-code-out{width:100%;min-height:120px;padding:12px 14px;border:1.5px solid #cbd5e1;border-radius:8px;font-family:'Courier New',monospace;font-size:.78rem;color:#1e293b;background:#f8fafc;resize:vertical;outline:none;word-break:break-all}\r\n\/* Diff *\/\r\n#pth-b64-wrapper .pth-diff-add{background:#ecfdf5;border-left:3px solid #10b981;padding:4px 10px;margin:2px 0;border-radius:0 4px 4px 0;font-family:'Courier New',monospace;font-size:.78rem;word-break:break-all}\r\n#pth-b64-wrapper .pth-diff-rem{background:#fef2f2;border-left:3px solid #dc2626;padding:4px 10px;margin:2px 0;border-radius:0 4px 4px 0;font-family:'Courier New',monospace;font-size:.78rem;word-break:break-all}\r\n#pth-b64-wrapper .pth-diff-eq{padding:4px 10px;margin:2px 0;font-family:'Courier New',monospace;font-size:.78rem;color:#334155;word-break:break-all}\r\n\/* Inspector *\/\r\n#pth-b64-wrapper .pth-inspect-row{background:#f8fafc;border:1px solid #e2e8f0;border-radius:7px;padding:8px 12px;margin-bottom:6px;font-size:.8rem}\r\n#pth-b64-wrapper .pth-inspect-key{font-weight:800;color:#1d4ed8;min-width:120px;display:inline-block}\r\n#pth-b64-wrapper .pth-inspect-val{color:#1e293b;font-family:'Courier New',monospace}\r\n\/* History *\/\r\n#pth-b64-wrapper .pth-history-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:8px 12px;margin-bottom:7px;cursor:pointer;transition:.2s;font-size:.75rem}\r\n#pth-b64-wrapper .pth-history-item:hover{border-color:#3b82f6;background:#eff6ff}\r\n#pth-b64-wrapper .pth-history-op{font-size:.68rem;font-weight:800;color:#2563eb;text-transform:uppercase}\r\n#pth-b64-wrapper .pth-history-val{color:#334155;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:'Courier New',monospace}\r\n\/* Sidebar *\/\r\n#pth-b64-wrapper .pth-sidebar-card{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:14px;margin-bottom:12px;box-shadow:0 2px 5px rgba(0,0,0,.04)}\r\n#pth-b64-wrapper .pth-sidebar-title{font-size:.85rem;font-weight:800;color:#0f172a;margin:0 0 10px;padding-bottom:8px;border-bottom:2px solid #e2e8f0}\r\n\/* Progress *\/\r\n#pth-b64-wrapper .pth-progress-wrap{width:100%;height:5px;background:#e2e8f0;border-radius:3px;overflow:hidden;margin:8px 0;display:none}\r\n#pth-b64-wrapper .pth-progress-bar{height:100%;background:linear-gradient(90deg,#3b82f6,#8b5cf6);width:0%;transition:width .3s ease;border-radius:3px}\r\n\/* Toast *\/\r\n#pth-b64-toast{position:fixed;bottom:22px;right:22px;background:#1e293b;color:#fff;padding:12px 20px;border-radius:10px;font-weight:800;font-size:.88rem;box-shadow:0 10px 30px rgba(0,0,0,.3);z-index:99999;display:none;align-items:center;gap:10px;max-width:320px}\r\n#pth-b64-toast.show{display:flex;animation:pthB64Slide .3s ease}\r\n@keyframes pthB64Slide{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}\r\n<\/style>\r\n\r\n<!-- Toast -->\r\n<div id=\"pth-b64-toast\">\u2705 Done!<\/div>\r\n\r\n<!-- WRAPPER -->\r\n<div id=\"pth-b64-wrapper\">\r\n\r\n  <!-- Top Bar -->\r\n  <div class=\"pth-top-bar\">\r\n    <div>\r\n      <h2 class=\"pth-tool-title\">\r\n        \ud83d\udd21 Base64 &amp; Encoding Studio\r\n        <span class=\"pth-version-badge\">v3.0 PRO<\/span>\r\n        <span class=\"pth-status-offline\">\ud83d\udd12 100% Offline<\/span>\r\n      <\/h2>\r\n      <span class=\"pth-subtitle\">Text \u00b7 Image \u00b7 File \u00b7 Batch \u00b7 CSS\/HTML Generator \u00b7 Diff \u00b7 Inspector \u2014 All-in-One<\/span>\r\n    <\/div>\r\n    <div class=\"pth-top-actions\">\r\n      <button class=\"pth-sample-btn\" id=\"pth-b64-sample-btn\" aria-label=\"Load sample text\">\ud83d\udca1 Sample<\/button>\r\n      <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-b64-dark-btn\" aria-label=\"Toggle dark mode\">\ud83c\udf19 Dark<\/button>\r\n      <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-b64-fw-btn\" aria-label=\"Toggle full width\">\u26f6 Full Width<\/button>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"pth-layout\" id=\"pth-b64-layout\">\r\n\r\n    <!-- MAIN COL -->\r\n    <div>\r\n      <div class=\"pth-tab-bar\" id=\"pth-b64-tab-bar\" role=\"tablist\">\r\n        <button class=\"pth-tab-btn active\" data-tab=\"encode\"     role=\"tab\" aria-selected=\"true\">\ud83d\udcdd Encode<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"decode\"            role=\"tab\" aria-selected=\"false\">\ud83d\udd13 Decode<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"image\"             role=\"tab\" aria-selected=\"false\">\ud83d\uddbc\ufe0f Image<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"file\"              role=\"tab\" aria-selected=\"false\">\ud83d\udcc1 File Encoder<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"batch\"             role=\"tab\" aria-selected=\"false\">\u26a1 Batch<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"generator\"         role=\"tab\" aria-selected=\"false\">\ud83c\udfa8 CSS\/HTML<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"diff\"              role=\"tab\" aria-selected=\"false\">\ud83d\udcca Diff<\/button>\r\n        <button class=\"pth-tab-btn\" data-tab=\"inspector\"         role=\"tab\" aria-selected=\"false\">\ud83d\udd0d Inspector<\/button>\r\n      <\/div>\r\n\r\n      <div class=\"pth-tab-wrap\">\r\n\r\n        <!-- TAB 1: ENCODE -->\r\n        <div class=\"pth-tab-panel active\" id=\"pth-panel-encode\">\r\n          <div class=\"pth-row\" style=\"margin-bottom:10px;\">\r\n            <div class=\"pth-chips-row\" style=\"margin-bottom:0;\">\r\n              <label class=\"pth-option-chip active\" id=\"pth-chip-urlsafe\"><input type=\"checkbox\" id=\"pth-url-safe\" aria-label=\"URL safe mode\"> \ud83d\udd17 URL Safe<\/label>\r\n              <label class=\"pth-option-chip active\" id=\"pth-chip-live\"><input type=\"checkbox\" id=\"pth-live-mode\" checked aria-label=\"Live encode mode\"> \u26a1 Live<\/label>\r\n              <label class=\"pth-option-chip\" id=\"pth-chip-linebreak\"><input type=\"checkbox\" id=\"pth-line-break\" aria-label=\"Add line breaks every 76 chars\"> \ud83d\udccf Line Breaks (76)<\/label>\r\n            <\/div>\r\n            <div style=\"margin-left:auto;display:flex;gap:6px;\">\r\n              <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-enc-paste-btn\" aria-label=\"Paste from clipboard\">\ud83d\udccb Paste<\/button>\r\n              <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-enc-clear-btn\" aria-label=\"Clear\">\ud83d\uddd1\ufe0f Clear<\/button>\r\n            <\/div>\r\n          <\/div>\r\n          <label class=\"pth-label\" for=\"pth-enc-input\">Input Text (UTF-8 \u00b7 Emoji \u00b7 Unicode supported)<\/label>\r\n          <textarea id=\"pth-enc-input\" class=\"pth-editor\" style=\"min-height:160px;\" placeholder=\"Type or paste any text \u2014 UTF-8, Emojis, Sinhala, Arabic, CJK all supported...\" aria-label=\"Text to encode to Base64\"><\/textarea>\r\n          <div class=\"pth-stats-row\" id=\"pth-enc-stats\" style=\"display:none;\">\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-enc-in-len\" style=\"color:#1d4ed8;\">0<\/span><span class=\"pth-stat-lbl\">Input chars<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-enc-out-len\" style=\"color:#047857;\">0<\/span><span class=\"pth-stat-lbl\">Output chars<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-enc-overhead\" style=\"color:#92400e;\">0%<\/span><span class=\"pth-stat-lbl\">Size increase<\/span><\/div>\r\n          <\/div>\r\n          <div style=\"text-align:center;margin:12px 0;\">\r\n            <button class=\"pth-btn pth-btn-success\" id=\"pth-enc-btn\" aria-label=\"Encode to Base64\" style=\"min-width:200px;\">\ud83d\udd21 Encode to Base64<\/button>\r\n          <\/div>\r\n          <label class=\"pth-label\" for=\"pth-enc-output\">Base64 Output<\/label>\r\n          <textarea id=\"pth-enc-output\" class=\"pth-editor pth-editor-out\" style=\"min-height:140px;\" readonly placeholder=\"Encoded Base64 string appears here...\" aria-label=\"Base64 encoded output\"><\/textarea>\r\n          <div style=\"display:flex;gap:7px;margin-top:10px;flex-wrap:wrap;\">\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-enc-copy-btn\" aria-label=\"Copy encoded output\">\ud83d\udccb Copy<\/button>\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-enc-download-btn\" aria-label=\"Download as .txt\">\u2b07 Download .txt<\/button>\r\n            <button class=\"pth-btn pth-btn-purple pth-btn-sm\" id=\"pth-enc-to-diff-btn\" aria-label=\"Send to Diff tab\">\u2192 Send to Diff<\/button>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 2: DECODE -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-decode\">\r\n          <div class=\"pth-row\" style=\"margin-bottom:10px;\">\r\n            <div class=\"pth-chips-row\" style=\"margin-bottom:0;\">\r\n              <label class=\"pth-option-chip active\" id=\"pth-chip-autopad\"><input type=\"checkbox\" id=\"pth-auto-pad\" checked aria-label=\"Auto-add padding\"> \ud83d\udd27 Auto-Pad<\/label>\r\n              <label class=\"pth-option-chip active\" id=\"pth-chip-urlfix\"><input type=\"checkbox\" id=\"pth-url-fix\" checked aria-label=\"Auto-fix URL safe chars\"> \ud83d\udd17 URL Fix<\/label>\r\n              <label class=\"pth-option-chip active\" id=\"pth-chip-stripws\"><input type=\"checkbox\" id=\"pth-strip-ws\" checked aria-label=\"Strip whitespace\"> \ud83e\uddf9 Strip Spaces<\/label>\r\n            <\/div>\r\n            <div style=\"margin-left:auto;display:flex;gap:6px;\">\r\n              <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-dec-paste-btn\" aria-label=\"Paste from clipboard\">\ud83d\udccb Paste<\/button>\r\n              <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-dec-clear-btn\" aria-label=\"Clear\">\ud83d\uddd1\ufe0f Clear<\/button>\r\n            <\/div>\r\n          <\/div>\r\n          <label class=\"pth-label\" for=\"pth-dec-input\">Base64 Input (URL-safe or standard)<\/label>\r\n          <textarea id=\"pth-dec-input\" class=\"pth-editor\" style=\"min-height:160px;\" placeholder=\"Paste Base64 string here \u2014 URL-safe, padded or unpadded \u2014 auto-normalized before decoding...\" aria-label=\"Base64 string to decode\"><\/textarea>\r\n          <div class=\"pth-stats-row\" id=\"pth-dec-stats\" style=\"display:none;\">\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-dec-in-len\" style=\"color:#1d4ed8;\">0<\/span><span class=\"pth-stat-lbl\">Input chars<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-dec-out-len\" style=\"color:#047857;\">0<\/span><span class=\"pth-stat-lbl\">Output chars<\/span><\/div>\r\n            <div class=\"pth-stat-chip\" id=\"pth-dec-valid-chip\" style=\"display:none;\"><span class=\"pth-stat-val\" id=\"pth-dec-valid\" style=\"color:#047857;\">\u2705<\/span><span class=\"pth-stat-lbl\">Valid B64<\/span><\/div>\r\n          <\/div>\r\n          <div style=\"text-align:center;margin:12px 0;\">\r\n            <button class=\"pth-btn pth-btn-success\" id=\"pth-dec-btn\" aria-label=\"Decode Base64\" style=\"min-width:200px;\">\ud83d\udd13 Decode Base64<\/button>\r\n          <\/div>\r\n          <label class=\"pth-label\" for=\"pth-dec-output\">Decoded Text Output<\/label>\r\n          <textarea id=\"pth-dec-output\" class=\"pth-editor pth-editor-out\" style=\"min-height:140px;\" readonly placeholder=\"Decoded text appears here...\" aria-label=\"Decoded text output\"><\/textarea>\r\n          <div style=\"display:flex;gap:7px;margin-top:10px;flex-wrap:wrap;\">\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-dec-copy-btn\" aria-label=\"Copy decoded output\">\ud83d\udccb Copy<\/button>\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-dec-download-btn\" aria-label=\"Download decoded text\">\u2b07 Download .txt<\/button>\r\n            <button class=\"pth-btn pth-btn-purple pth-btn-sm\" id=\"pth-dec-to-encode-btn\" aria-label=\"Re-encode the decoded output\">\u21ba Re-Encode<\/button>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 3: IMAGE -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-image\">\r\n          <div style=\"display:grid;grid-template-columns:1fr 1fr;gap:16px;\">\r\n            <div>\r\n              <div style=\"font-size:.75rem;font-weight:800;color:#334155;text-transform:uppercase;margin-bottom:10px;\">\ud83d\uddbc\ufe0f Image \u2192 Base64<\/div>\r\n              <input type=\"file\" id=\"pth-img-file\" accept=\"image\/*\" style=\"display:none;\" aria-label=\"Upload image file\">\r\n              <div class=\"pth-drop-zone\" id=\"pth-img-drop-zone\" role=\"button\" tabindex=\"0\" aria-label=\"Drop image here or click to upload\">\r\n                <span class=\"pth-drop-icon\">\ud83d\udcc1<\/span>\r\n                <p style=\"font-size:.9rem;font-weight:800;color:#0f172a;margin:0 0 4px;\">Drop Image or Click to Upload<\/p>\r\n                <p style=\"font-size:.78rem;color:#334155;margin:0;\">PNG \u00b7 JPG \u00b7 SVG \u00b7 WEBP \u00b7 GIF (Max 10MB)<\/p>\r\n              <\/div>\r\n              <div class=\"pth-img-preview-wrap\" id=\"pth-img-preview-wrap\">\r\n                <img decoding=\"async\" id=\"pth-img-preview\" class=\"pth-img-preview\" src=\"\" alt=\"Uploaded image preview\" width=\"300\" height=\"200\">\r\n                <div class=\"pth-img-meta\" id=\"pth-img-meta\"><\/div>\r\n                <div class=\"pth-progress-wrap\" id=\"pth-img-progress-wrap\"><div class=\"pth-progress-bar\" id=\"pth-img-progress-bar\"><\/div><\/div>\r\n              <\/div>\r\n              <div class=\"pth-chips-row\" style=\"margin-top:10px;\">\r\n                <label class=\"pth-option-chip active\" id=\"pth-chip-datauri\"><input type=\"checkbox\" id=\"pth-include-data-uri\" checked aria-label=\"Include data URI prefix\"> \ud83d\udcce Include data URI<\/label>\r\n              <\/div>\r\n              <textarea id=\"pth-img-enc-output\" class=\"pth-editor pth-editor-out\" style=\"min-height:100px;margin-top:8px;\" readonly placeholder=\"data:image\/png;base64,iVBOR...\" aria-label=\"Image Base64 output\"><\/textarea>\r\n              <div style=\"display:flex;gap:6px;margin-top:8px;flex-wrap:wrap;\">\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-img-copy-btn\" aria-label=\"Copy image Base64\">\ud83d\udccb Copy<\/button>\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-img-download-btn\" aria-label=\"Download Base64 txt\">\u2b07 .txt<\/button>\r\n                <button class=\"pth-btn pth-btn-purple pth-btn-sm\" id=\"pth-img-to-css-btn\" aria-label=\"Send to CSS Generator\">\ud83c\udfa8 \u2192 CSS<\/button>\r\n              <\/div>\r\n            <\/div>\r\n            <div>\r\n              <div style=\"font-size:.75rem;font-weight:800;color:#334155;text-transform:uppercase;margin-bottom:10px;\">\ud83d\udc41\ufe0f Base64 \u2192 Image Preview<\/div>\r\n              <textarea id=\"pth-img-dec-input\" class=\"pth-editor\" style=\"min-height:120px;\" placeholder=\"Paste Base64 image string (with or without data:image\/ prefix)...\" aria-label=\"Base64 image string to preview\"><\/textarea>\r\n              <button class=\"pth-btn pth-btn-primary\" id=\"pth-img-preview-btn\" style=\"width:100%;margin:10px 0;\" aria-label=\"Preview Base64 image\">\ud83d\udc41\ufe0f Preview Image<\/button>\r\n              <div class=\"pth-img-preview-wrap\" id=\"pth-img-dec-preview-wrap\">\r\n                <img decoding=\"async\" id=\"pth-img-dec-preview\" class=\"pth-img-preview\" src=\"\" alt=\"Decoded image preview\" width=\"300\" height=\"200\">\r\n              <\/div>\r\n              <button class=\"pth-btn pth-btn-success pth-btn-sm\" id=\"pth-img-dec-download-btn\" style=\"width:100%;margin-top:8px;display:none;\" aria-label=\"Download decoded image\">\u2b07 Download Image<\/button>\r\n            <\/div>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 4: FILE ENCODER -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-file\">\r\n          <p style=\"font-size:.84rem;color:#334155;font-weight:600;margin:0 0 14px;\">Encode any file type (PDF, JSON, ZIP, audio, video) to Base64. The entire file is read client-side \u2014 no upload to any server.<\/p>\r\n          <input type=\"file\" id=\"pth-any-file\" style=\"display:none;\" aria-label=\"Upload any file for Base64 encoding\">\r\n          <div class=\"pth-drop-zone\" id=\"pth-file-drop-zone\" role=\"button\" tabindex=\"0\" aria-label=\"Drop any file here to encode\">\r\n            <span class=\"pth-drop-icon\">\ud83d\udce6<\/span>\r\n            <p style=\"font-size:.9rem;font-weight:800;color:#0f172a;margin:0 0 4px;\">Drop Any File \u2014 PDF, JSON, ZIP, Audio, Video<\/p>\r\n            <p style=\"font-size:.78rem;color:#334155;margin:0;\">Processed entirely in your browser \u00b7 No server upload<\/p>\r\n          <\/div>\r\n          <div class=\"pth-stats-row\" id=\"pth-file-stats\" style=\"display:none;margin-top:12px;\">\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-file-name-stat\" style=\"font-size:.72rem;color:#1d4ed8;\">\u2014<\/span><span class=\"pth-stat-lbl\">File Name<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-file-size-stat\" style=\"color:#7c3aed;\">\u2014<\/span><span class=\"pth-stat-lbl\">Size<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-file-type-stat\" style=\"font-size:.72rem;color:#047857;\">\u2014<\/span><span class=\"pth-stat-lbl\">MIME Type<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-file-b64-size-stat\" style=\"color:#92400e;\">\u2014<\/span><span class=\"pth-stat-lbl\">B64 Size<\/span><\/div>\r\n          <\/div>\r\n          <div class=\"pth-progress-wrap\" id=\"pth-file-progress-wrap\" style=\"margin:10px 0;\"><div class=\"pth-progress-bar\" id=\"pth-file-progress-bar\"><\/div><\/div>\r\n          <label class=\"pth-label\" style=\"margin-top:10px;\" for=\"pth-file-output\">Base64 Output (Full Data URI)<\/label>\r\n          <textarea id=\"pth-file-output\" class=\"pth-editor pth-editor-out\" style=\"min-height:180px;\" readonly placeholder=\"Encoded file Base64 appears here...\" aria-label=\"Encoded file Base64 output\"><\/textarea>\r\n          <div style=\"display:flex;gap:7px;margin-top:10px;flex-wrap:wrap;\">\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-file-copy-btn\" aria-label=\"Copy file Base64\">\ud83d\udccb Copy<\/button>\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-file-download-btn\" aria-label=\"Download as .txt\">\u2b07 Download .txt<\/button>\r\n            <button class=\"pth-btn pth-btn-danger pth-btn-sm\" id=\"pth-file-clear-btn\" aria-label=\"Clear file output\">\ud83d\uddd1\ufe0f Clear<\/button>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 5: BATCH -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-batch\">\r\n          <p style=\"font-size:.84rem;color:#334155;font-weight:600;margin:0 0 12px;\">Enter one item per line \u2014 each is encoded or decoded independently. Download all results as CSV.<\/p>\r\n          <div class=\"pth-row\" style=\"margin-bottom:12px;\">\r\n            <div class=\"pth-chips-row\" style=\"margin-bottom:0;\">\r\n              <button class=\"pth-conv-btn active\" data-bmode=\"encode\" aria-pressed=\"true\" style=\"padding:7px 14px;background:#f8fafc;border:1.5px solid #e2e8f0;border-radius:7px;font-size:.78rem;font-weight:800;color:#334155;cursor:pointer;font-family:'Inter',sans-serif;\">Batch Encode<\/button>\r\n              <button class=\"pth-conv-btn\" data-bmode=\"decode\" aria-pressed=\"false\" style=\"padding:7px 14px;background:#f8fafc;border:1.5px solid #e2e8f0;border-radius:7px;font-size:.78rem;font-weight:800;color:#334155;cursor:pointer;font-family:'Inter',sans-serif;margin-left:6px;\">Batch Decode<\/button>\r\n            <\/div>\r\n            <div style=\"margin-left:auto;display:flex;gap:6px;\">\r\n              <button class=\"pth-btn pth-btn-primary pth-btn-sm\" id=\"pth-batch-run-btn\" aria-label=\"Run batch operation\">\u25b6 Run Batch<\/button>\r\n              <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-batch-csv-btn\" aria-label=\"Download batch results as CSV\">\u2b07 CSV<\/button>\r\n              <button class=\"pth-btn pth-btn-danger pth-btn-sm\" id=\"pth-batch-clear-btn\" aria-label=\"Clear batch\">\ud83d\uddd1\ufe0f Clear<\/button>\r\n            <\/div>\r\n          <\/div>\r\n          <label class=\"pth-label\" for=\"pth-batch-input\">Input (one per line)<\/label>\r\n          <textarea id=\"pth-batch-input\" class=\"pth-editor\" style=\"min-height:120px;\" placeholder=\"Hello World&#10;PTH Tool&#10;Sinhala: \u0d86\u0dba\u0dd4\u0db6\u0ddd\u0dc0\u0db1\u0dca&#10;Emoji: \ud83d\ude80\ud83d\udd25\" aria-label=\"Batch input \u2014 one item per line\"><\/textarea>\r\n          <div style=\"font-size:.72rem;font-weight:800;color:#334155;text-transform:uppercase;letter-spacing:.4px;margin:10px 0 6px;\">Results (<span id=\"pth-batch-count\">0<\/span> items)<\/div>\r\n          <div id=\"pth-batch-results\" style=\"max-height:280px;overflow-y:auto;\"><\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 6: CSS\/HTML GENERATOR -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-generator\">\r\n          <p style=\"font-size:.84rem;color:#334155;font-weight:600;margin:0 0 14px;\">Convert a Base64 image into ready-to-paste CSS background, HTML img tag, or favicon link tag.<\/p>\r\n          <div class=\"pth-row\" style=\"margin-bottom:12px;\">\r\n            <div style=\"flex:1;\">\r\n              <label class=\"pth-label\" for=\"pth-gen-b64-input\">Base64 Image Data URI (from Image tab)<\/label>\r\n              <textarea id=\"pth-gen-b64-input\" class=\"pth-editor\" style=\"min-height:90px;\" placeholder=\"Paste data:image\/png;base64,... here or click Load from Image tab...\" aria-label=\"Base64 image for CSS\/HTML generation\"><\/textarea>\r\n            <\/div>\r\n          <\/div>\r\n          <div style=\"display:flex;gap:8px;margin-bottom:14px;flex-wrap:wrap;\">\r\n            <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-gen-load-btn\" aria-label=\"Load Base64 from Image tab\">\ud83d\udce5 Load from Image Tab<\/button>\r\n            <button class=\"pth-btn pth-btn-primary\" id=\"pth-gen-run-btn\" aria-label=\"Generate CSS and HTML snippets\">\ud83c\udfa8 Generate Snippets<\/button>\r\n          <\/div>\r\n          <div id=\"pth-gen-outputs\" style=\"display:none;\">\r\n            <div style=\"margin-bottom:12px;\">\r\n              <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:5px;\">\r\n                <span style=\"font-size:.72rem;font-weight:800;color:#334155;text-transform:uppercase;\">CSS Background<\/span>\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-gen-copy-css-btn\" aria-label=\"Copy CSS snippet\">\ud83d\udccb Copy<\/button>\r\n              <\/div>\r\n              <textarea id=\"pth-gen-css-out\" class=\"pth-code-out\" readonly aria-label=\"Generated CSS snippet\"><\/textarea>\r\n            <\/div>\r\n            <div style=\"margin-bottom:12px;\">\r\n              <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:5px;\">\r\n                <span style=\"font-size:.72rem;font-weight:800;color:#334155;text-transform:uppercase;\">HTML img tag<\/span>\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-gen-copy-html-btn\" aria-label=\"Copy HTML snippet\">\ud83d\udccb Copy<\/button>\r\n              <\/div>\r\n              <textarea id=\"pth-gen-html-out\" class=\"pth-code-out\" rows=\"2\" readonly aria-label=\"Generated HTML img tag\"><\/textarea>\r\n            <\/div>\r\n            <div style=\"margin-bottom:12px;\">\r\n              <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:5px;\">\r\n                <span style=\"font-size:.72rem;font-weight:800;color:#334155;text-transform:uppercase;\">Favicon link tag<\/span>\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-gen-copy-fav-btn\" aria-label=\"Copy favicon snippet\">\ud83d\udccb Copy<\/button>\r\n              <\/div>\r\n              <textarea id=\"pth-gen-fav-out\" class=\"pth-code-out\" rows=\"2\" readonly aria-label=\"Generated favicon link tag\"><\/textarea>\r\n            <\/div>\r\n            <div>\r\n              <div style=\"display:flex;justify-content:space-between;align-items:center;margin-bottom:5px;\">\r\n                <span style=\"font-size:.72rem;font-weight:800;color:#334155;text-transform:uppercase;\">Markdown image<\/span>\r\n                <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-gen-copy-md-btn\" aria-label=\"Copy Markdown snippet\">\ud83d\udccb Copy<\/button>\r\n              <\/div>\r\n              <textarea id=\"pth-gen-md-out\" class=\"pth-code-out\" rows=\"2\" readonly aria-label=\"Generated Markdown image syntax\"><\/textarea>\r\n            <\/div>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 7: DIFF -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-diff\">\r\n          <p style=\"font-size:.84rem;color:#334155;font-weight:600;margin:0 0 12px;\">Compare two Base64 strings \u2014 identify if they encode the same content, or see character-level differences.<\/p>\r\n          <div style=\"display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:12px;\">\r\n            <div>\r\n              <label class=\"pth-label\" for=\"pth-diff-a\">Base64 String A<\/label>\r\n              <textarea id=\"pth-diff-a\" class=\"pth-editor\" style=\"min-height:150px;\" placeholder=\"Paste first Base64 string...\" aria-label=\"First Base64 string for diff\"><\/textarea>\r\n            <\/div>\r\n            <div>\r\n              <label class=\"pth-label\" for=\"pth-diff-b\">Base64 String B<\/label>\r\n              <textarea id=\"pth-diff-b\" class=\"pth-editor\" style=\"min-height:150px;\" placeholder=\"Paste second Base64 string...\" aria-label=\"Second Base64 string for diff\"><\/textarea>\r\n            <\/div>\r\n          <\/div>\r\n          <button class=\"pth-btn pth-btn-primary\" id=\"pth-diff-run-btn\" style=\"width:100%;margin-bottom:14px;\" aria-label=\"Compare Base64 strings\">\ud83d\udcca Compare Strings<\/button>\r\n          <div class=\"pth-stats-row\" id=\"pth-diff-stats\" style=\"display:none;\">\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-diff-len-a\" style=\"color:#1d4ed8;\">0<\/span><span class=\"pth-stat-lbl\">A length<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-diff-len-b\" style=\"color:#7c3aed;\">0<\/span><span class=\"pth-stat-lbl\">B length<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-diff-match\" style=\"color:#047857;\">\u2014<\/span><span class=\"pth-stat-lbl\">Match<\/span><\/div>\r\n            <div class=\"pth-stat-chip\"><span class=\"pth-stat-val\" id=\"pth-diff-first-diff\" style=\"color:#dc2626;\">\u2014<\/span><span class=\"pth-stat-lbl\">First diff at<\/span><\/div>\r\n          <\/div>\r\n          <div id=\"pth-diff-result\" style=\"margin-top:10px;max-height:240px;overflow-y:auto;font-size:.82rem;\"><\/div>\r\n        <\/div>\r\n\r\n        <!-- TAB 8: INSPECTOR -->\r\n        <div class=\"pth-tab-panel\" id=\"pth-panel-inspector\">\r\n          <p style=\"font-size:.84rem;color:#334155;font-weight:600;margin:0 0 12px;\">Paste any Base64 string \u2014 the Inspector detects its type, validates format, shows decoded preview, and reports all metadata.<\/p>\r\n          <label class=\"pth-label\" for=\"pth-inspect-input\">Base64 String to Inspect<\/label>\r\n          <textarea id=\"pth-inspect-input\" class=\"pth-editor\" style=\"min-height:120px;\" placeholder=\"Paste any Base64 string \u2014 text, image, file...\" aria-label=\"Base64 string to inspect\"><\/textarea>\r\n          <button class=\"pth-btn pth-btn-primary\" id=\"pth-inspect-btn\" style=\"width:100%;margin:10px 0;\" aria-label=\"Inspect Base64 string\">\ud83d\udd0d Inspect<\/button>\r\n          <div id=\"pth-inspect-results\" style=\"display:none;\">\r\n            <div id=\"pth-inspect-rows\" style=\"margin-bottom:12px;\"><\/div>\r\n            <div id=\"pth-inspect-preview-wrap\" class=\"pth-img-preview-wrap\">\r\n              <img decoding=\"async\" id=\"pth-inspect-img\" class=\"pth-img-preview\" src=\"\" alt=\"Inspected image preview\" width=\"300\" height=\"200\">\r\n            <\/div>\r\n            <label class=\"pth-label\" for=\"pth-inspect-decoded\">Decoded Preview (first 500 chars)<\/label>\r\n            <textarea id=\"pth-inspect-decoded\" class=\"pth-editor pth-editor-out\" style=\"min-height:80px;\" readonly aria-label=\"Decoded preview of inspected Base64\"><\/textarea>\r\n          <\/div>\r\n        <\/div>\r\n\r\n      <\/div><!-- \/tab-wrap -->\r\n    <\/div><!-- \/main col -->\r\n\r\n    <!-- SIDEBAR -->\r\n    <div id=\"pth-b64-sidebar\">\r\n\r\n      <!-- History -->\r\n      <div class=\"pth-sidebar-card\">\r\n        <h3 class=\"pth-sidebar-title\">\ud83d\udd52 Recent Operations<\/h3>\r\n        <div id=\"pth-b64-history\"><p style=\"font-size:.78rem;color:#334155;font-style:italic;text-align:center;margin:12px 0;\">No history yet.<\/p><\/div>\r\n        <button class=\"pth-btn pth-btn-secondary pth-btn-sm\" id=\"pth-clear-history-btn\" style=\"width:100%;margin-top:8px;display:none;\" aria-label=\"Clear history\">\ud83d\uddd1\ufe0f Clear<\/button>\r\n      <\/div>\r\n\r\n      <!-- Quick Reference -->\r\n      <div class=\"pth-sidebar-card\">\r\n        <h3 class=\"pth-sidebar-title\">\ud83d\udcda Quick Reference<\/h3>\r\n        <div style=\"font-size:.78rem;color:#1e293b;line-height:1.8;\">\r\n          <div style=\"margin-bottom:8px;padding:7px 9px;background:#eff6ff;border-radius:6px;border-left:3px solid #3b82f6;\">\r\n            <strong style=\"color:#1d4ed8;\">Standard Base64:<\/strong> A\u2013Z, a\u2013z, 0\u20139, +, \/, =\r\n          <\/div>\r\n          <div style=\"margin-bottom:8px;padding:7px 9px;background:#f5f3ff;border-radius:6px;border-left:3px solid #8b5cf6;\">\r\n            <strong style=\"color:#6d28d9;\">URL Safe Base64:<\/strong> replaces +\u2192- and \/\u2192_\r\n          <\/div>\r\n          <div style=\"margin-bottom:8px;padding:7px 9px;background:#fff7ed;border-radius:6px;border-left:3px solid #f59e0b;\">\r\n            <strong style=\"color:#92400e;\">Size overhead:<\/strong> ~33% increase from raw\r\n          <\/div>\r\n          <div style=\"padding:7px 9px;background:#f0fdf4;border-radius:6px;border-left:3px solid #10b981;\">\r\n            <strong style=\"color:#047857;\">UTF-8 encoding:<\/strong> TextEncoder \u2192 btoa()\r\n          <\/div>\r\n        <\/div>\r\n      <\/div>\r\n\r\n      <!-- Privacy -->\r\n      <div class=\"pth-sidebar-card\" style=\"background:#f0fdf4;border-color:#a7f3d0;\">\r\n        <h3 class=\"pth-sidebar-title\" style=\"color:#065f46;border-bottom-color:#6ee7b7;\">\ud83d\udee1\ufe0f 100% Private<\/h3>\r\n        <p style=\"font-size:.78rem;color:#047857;font-weight:500;margin:0;line-height:1.6;\">All encoding, decoding, and file processing runs in your browser. No data \u2014 text, images, or files \u2014 is ever sent to any server.<\/p>\r\n      <\/div>\r\n\r\n    <\/div><!-- \/sidebar -->\r\n\r\n  <\/div><!-- \/layout -->\r\n<\/div><!-- \/wrapper -->\r\n\r\n<script data-no-optimize=\"1\" data-no-minify=\"1\" data-cfasync=\"false\">\r\n(function(){\r\n\"use strict\";\r\n\r\nwindow.pthBase64StudioApp = {\r\n  initialized: false,\r\n  currentTab: 'encode',\r\n  currentBatchMode: 'encode',\r\n  batchResults: [],\r\n  history: [],\r\n  imgB64Cache: '',\r\n  UI: {},\r\n\r\n  init: function(){\r\n    this.cacheDOM();\r\n    this.attachEvents();\r\n  },\r\n\r\n  cacheDOM: function(){\r\n    var g = function(id){ return document.getElementById(id); };\r\n    this.UI = {\r\n      wrapper: g('pth-b64-wrapper'), layout: g('pth-b64-layout'),\r\n      fwBtn: g('pth-b64-fw-btn'), darkBtn: g('pth-b64-dark-btn'),\r\n      sampleBtn: g('pth-b64-sample-btn'), tabBar: g('pth-b64-tab-bar'),\r\n      toast: g('pth-b64-toast'),\r\n      \/* Encode *\/\r\n      encInput: g('pth-enc-input'), encOutput: g('pth-enc-output'),\r\n      encBtn: g('pth-enc-btn'), encPasteBtn: g('pth-enc-paste-btn'),\r\n      encClearBtn: g('pth-enc-clear-btn'), encCopyBtn: g('pth-enc-copy-btn'),\r\n      encDownloadBtn: g('pth-enc-download-btn'), encToDiffBtn: g('pth-enc-to-diff-btn'),\r\n      encStats: g('pth-enc-stats'), encInLen: g('pth-enc-in-len'),\r\n      encOutLen: g('pth-enc-out-len'), encOverhead: g('pth-enc-overhead'),\r\n      urlSafe: g('pth-url-safe'), liveMode: g('pth-live-mode'),\r\n      lineBreak: g('pth-line-break'),\r\n      chipUrlsafe: g('pth-chip-urlsafe'), chipLive: g('pth-chip-live'),\r\n      chipLinebreak: g('pth-chip-linebreak'),\r\n      \/* Decode *\/\r\n      decInput: g('pth-dec-input'), decOutput: g('pth-dec-output'),\r\n      decBtn: g('pth-dec-btn'), decPasteBtn: g('pth-dec-paste-btn'),\r\n      decClearBtn: g('pth-dec-clear-btn'), decCopyBtn: g('pth-dec-copy-btn'),\r\n      decDownloadBtn: g('pth-dec-download-btn'), decToEncBtn: g('pth-dec-to-encode-btn'),\r\n      decStats: g('pth-dec-stats'), decInLen: g('pth-dec-in-len'),\r\n      decOutLen: g('pth-dec-out-len'), decValidChip: g('pth-dec-valid-chip'),\r\n      decValid: g('pth-dec-valid'),\r\n      autoPad: g('pth-auto-pad'), urlFix: g('pth-url-fix'), stripWs: g('pth-strip-ws'),\r\n      chipAutopad: g('pth-chip-autopad'), chipUrlfx: g('pth-chip-urlfix'), chipStripws: g('pth-chip-stripws'),\r\n      \/* Image *\/\r\n      imgFile: g('pth-img-file'), imgDropZone: g('pth-img-drop-zone'),\r\n      imgPreviewWrap: g('pth-img-preview-wrap'), imgPreview: g('pth-img-preview'),\r\n      imgMeta: g('pth-img-meta'), imgProgressWrap: g('pth-img-progress-wrap'),\r\n      imgProgressBar: g('pth-img-progress-bar'), imgEncOutput: g('pth-img-enc-output'),\r\n      imgCopyBtn: g('pth-img-copy-btn'), imgDownloadBtn: g('pth-img-download-btn'),\r\n      imgToCssBtn: g('pth-img-to-css-btn'), includeDataUri: g('pth-include-data-uri'),\r\n      chipDatauri: g('pth-chip-datauri'),\r\n      imgDecInput: g('pth-img-dec-input'), imgPreviewBtn: g('pth-img-preview-btn'),\r\n      imgDecPreviewWrap: g('pth-img-dec-preview-wrap'), imgDecPreview: g('pth-img-dec-preview'),\r\n      imgDecDownloadBtn: g('pth-img-dec-download-btn'),\r\n      \/* File *\/\r\n      anyFile: g('pth-any-file'), fileDropZone: g('pth-file-drop-zone'),\r\n      fileStats: g('pth-file-stats'), fileNameStat: g('pth-file-name-stat'),\r\n      fileSizeStat: g('pth-file-size-stat'), fileTypeStat: g('pth-file-type-stat'),\r\n      fileB64SizeStat: g('pth-file-b64-size-stat'),\r\n      fileProgressWrap: g('pth-file-progress-wrap'), fileProgressBar: g('pth-file-progress-bar'),\r\n      fileOutput: g('pth-file-output'), fileCopyBtn: g('pth-file-copy-btn'),\r\n      fileDownloadBtn: g('pth-file-download-btn'), fileClearBtn: g('pth-file-clear-btn'),\r\n      \/* Batch *\/\r\n      batchInput: g('pth-batch-input'), batchRunBtn: g('pth-batch-run-btn'),\r\n      batchCsvBtn: g('pth-batch-csv-btn'), batchClearBtn: g('pth-batch-clear-btn'),\r\n      batchResults: g('pth-batch-results'), batchCount: g('pth-batch-count'),\r\n      \/* Generator *\/\r\n      genB64Input: g('pth-gen-b64-input'), genLoadBtn: g('pth-gen-load-btn'),\r\n      genRunBtn: g('pth-gen-run-btn'), genOutputs: g('pth-gen-outputs'),\r\n      genCssOut: g('pth-gen-css-out'), genHtmlOut: g('pth-gen-html-out'),\r\n      genFavOut: g('pth-gen-fav-out'), genMdOut: g('pth-gen-md-out'),\r\n      genCopyCss: g('pth-gen-copy-css-btn'), genCopyHtml: g('pth-gen-copy-html-btn'),\r\n      genCopyFav: g('pth-gen-copy-fav-btn'), genCopyMd: g('pth-gen-copy-md-btn'),\r\n      \/* Diff *\/\r\n      diffA: g('pth-diff-a'), diffB: g('pth-diff-b'),\r\n      diffRunBtn: g('pth-diff-run-btn'), diffStats: g('pth-diff-stats'),\r\n      diffLenA: g('pth-diff-len-a'), diffLenB: g('pth-diff-len-b'),\r\n      diffMatch: g('pth-diff-match'), diffFirstDiff: g('pth-diff-first-diff'),\r\n      diffResult: g('pth-diff-result'),\r\n      \/* Inspector *\/\r\n      inspectInput: g('pth-inspect-input'), inspectBtn: g('pth-inspect-btn'),\r\n      inspectResults: g('pth-inspect-results'), inspectRows: g('pth-inspect-rows'),\r\n      inspectPreviewWrap: g('pth-inspect-preview-wrap'), inspectImg: g('pth-inspect-img'),\r\n      inspectDecoded: g('pth-inspect-decoded'),\r\n      \/* History *\/\r\n      historyList: g('pth-b64-history'), clearHistoryBtn: g('pth-clear-history-btn')\r\n    };\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 UTILS \u2500\u2500\u2500 *\/\r\n  showToast: function(msg, type){\r\n    if(!this.UI.toast) return;\r\n    var colors = {success:'#1e293b',error:'#dc2626',info:'#1d4ed8',warn:'#92400e'};\r\n    this.UI.toast.style.background = colors[type||'success']||'#1e293b';\r\n    this.UI.toast.innerHTML = (type==='error'?'\u274c ':type==='info'?'\u2139\ufe0f ':type==='warn'?'\u26a0\ufe0f ':'\u2705 ') + msg;\r\n    this.UI.toast.classList.add('show');\r\n    clearTimeout(this._tt);\r\n    var self = this;\r\n    this._tt = setTimeout(function(){ self.UI.toast.classList.remove('show'); }, 3200);\r\n  },\r\n  bindEv: function(el, ev, fn){ if(el) el.addEventListener(ev, fn); },\r\n  copy: function(text, label){\r\n    navigator.clipboard.writeText(text||'').catch(function(){});\r\n    this.showToast((label||'Text') + ' copied!');\r\n  },\r\n  download: function(text, name, mime){\r\n    var a = document.createElement('a');\r\n    a.href = URL.createObjectURL(new Blob([text], {type: mime||'text\/plain'}));\r\n    a.download = name; a.click();\r\n    this.showToast(name + ' downloaded!');\r\n  },\r\n  fmtBytes: function(n){ return n<1024?n+'B':n<1048576?(n\/1024).toFixed(1)+'KB':(n\/1048576).toFixed(2)+'MB'; },\r\n\r\n  \/* \u2500\u2500\u2500 ENCODE (UTF-8 safe) \u2500\u2500\u2500 *\/\r\n  encodeB64: function(text, urlSafe, lineBreak){\r\n    var bytes = new TextEncoder().encode(text);\r\n    var binStr = '';\r\n    for(var i=0;i<bytes.length;i++) binStr += String.fromCharCode(bytes[i]);\r\n    var encoded = btoa(binStr);\r\n    if(urlSafe) encoded = encoded.replace(\/\\+\/g,'-').replace(\/\\\/\/g,'_').replace(\/=+$\/,'');\r\n    if(lineBreak){\r\n      var lines = [];\r\n      for(var j=0;j<encoded.length;j+=76) lines.push(encoded.substring(j,j+76));\r\n      encoded = lines.join('\\n');\r\n    }\r\n    return encoded;\r\n  },\r\n  decodeB64: function(text, autoPad, urlFix, stripWs){\r\n    var s = text;\r\n    if(stripWs) s = s.replace(\/\\s+\/g,'');\r\n    if(urlFix) s = s.replace(\/-\/g,'+').replace(\/_\/g,'\/');\r\n    if(autoPad){ while(s.length%4) s += '='; }\r\n    var binStr = atob(s);\r\n    var bytes = new Uint8Array(binStr.length);\r\n    for(var i=0;i<binStr.length;i++) bytes[i] = binStr.charCodeAt(i);\r\n    return new TextDecoder().decode(bytes);\r\n  },\r\n  isValidB64: function(s){\r\n    try{ var t = s.replace(\/\\s+\/g,'').replace(\/-\/g,'+').replace(\/_\/g,'\/'); while(t.length%4) t+='='; atob(t); return true; } catch(e){ return false; }\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 ENCODE TAB \u2500\u2500\u2500 *\/\r\n  runEncode: function(){\r\n    var text = this.UI.encInput ? this.UI.encInput.value : '';\r\n    if(!text){ this.showToast('Enter text to encode!','error'); return; }\r\n    try{\r\n      var urlSafe = this.UI.urlSafe ? this.UI.urlSafe.checked : false;\r\n      var lineBreak = this.UI.lineBreak ? this.UI.lineBreak.checked : false;\r\n      var result = this.encodeB64(text, urlSafe, lineBreak);\r\n      if(this.UI.encOutput) this.UI.encOutput.value = result;\r\n      var inLen = text.length, outLen = result.replace(\/\\n\/g,'').length;\r\n      var overhead = inLen > 0 ? Math.round(((outLen - inLen) \/ inLen) * 100) : 0;\r\n      if(this.UI.encInLen) this.UI.encInLen.textContent = inLen;\r\n      if(this.UI.encOutLen) this.UI.encOutLen.textContent = outLen;\r\n      if(this.UI.encOverhead) this.UI.encOverhead.textContent = '+' + overhead + '%';\r\n      if(this.UI.encStats) this.UI.encStats.style.display = 'flex';\r\n      this.addHistory('Encode', text.substring(0,30), result.substring(0,40));\r\n      this.showToast('Encoded! ' + (urlSafe ? '(URL Safe)':''));\r\n    } catch(e){ this.showToast('Encoding failed: ' + e.message,'error'); }\r\n  },\r\n  runDecode: function(){\r\n    var text = this.UI.decInput ? this.UI.decInput.value.trim() : '';\r\n    if(!text){ this.showToast('Enter Base64 to decode!','error'); return; }\r\n    var valid = this.isValidB64(text);\r\n    if(this.UI.decValidChip) this.UI.decValidChip.style.display = 'block';\r\n    if(this.UI.decValid){\r\n      this.UI.decValid.textContent = valid ? '\u2705' : '\u274c';\r\n      this.UI.decValid.style.color = valid ? '#047857' : '#dc2626';\r\n    }\r\n    if(!valid){ this.showToast('Invalid Base64 string!','error'); if(this.UI.decStats) this.UI.decStats.style.display='flex'; return; }\r\n    try{\r\n      var autoPad = this.UI.autoPad ? this.UI.autoPad.checked : true;\r\n      var urlFix  = this.UI.urlFix  ? this.UI.urlFix.checked  : true;\r\n      var stripWs = this.UI.stripWs ? this.UI.stripWs.checked : true;\r\n      var result = this.decodeB64(text, autoPad, urlFix, stripWs);\r\n      if(this.UI.decOutput) this.UI.decOutput.value = result;\r\n      if(this.UI.decInLen) this.UI.decInLen.textContent = text.length;\r\n      if(this.UI.decOutLen) this.UI.decOutLen.textContent = result.length;\r\n      if(this.UI.decStats) this.UI.decStats.style.display = 'flex';\r\n      this.addHistory('Decode', text.substring(0,30), result.substring(0,40));\r\n      this.showToast('Decoded successfully!');\r\n    } catch(e){ this.showToast('Decoding failed \u2014 check input.','error'); }\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 IMAGE ENCODE \u2500\u2500\u2500 *\/\r\n  handleImageFile: function(file){\r\n    if(!file){ return; }\r\n    if(!file.type.startsWith('image\/')){ this.showToast('Please upload an image file!','error'); return; }\r\n    if(file.size > 10*1024*1024){ this.showToast('Max 10MB!','error'); return; }\r\n    var self = this;\r\n    if(this.UI.imgProgressWrap) this.UI.imgProgressWrap.style.display = 'block';\r\n    if(this.UI.imgProgressBar) this.UI.imgProgressBar.style.width = '20%';\r\n    var reader = new FileReader();\r\n    reader.onload = function(e){\r\n      var dataUri = e.target.result;\r\n      if(self.UI.imgProgressBar) self.UI.imgProgressBar.style.width = '80%';\r\n      self.imgB64Cache = dataUri;\r\n      var includeUri = self.UI.includeDataUri ? self.UI.includeDataUri.checked : true;\r\n      if(self.UI.imgEncOutput) self.UI.imgEncOutput.value = includeUri ? dataUri : dataUri.split(',')[1];\r\n      if(self.UI.imgPreview){ self.UI.imgPreview.src = dataUri; }\r\n      if(self.UI.imgMeta) self.UI.imgMeta.textContent = file.name + ' \u00b7 ' + (file.size\/1024).toFixed(2) + 'KB \u00b7 ' + file.type;\r\n      if(self.UI.imgPreviewWrap) self.UI.imgPreviewWrap.style.display = 'block';\r\n      if(self.UI.imgProgressBar) self.UI.imgProgressBar.style.width = '100%';\r\n      setTimeout(function(){ if(self.UI.imgProgressWrap) self.UI.imgProgressWrap.style.display='none'; }, 1000);\r\n      self.addHistory('ImgEncode', file.name, dataUri.substring(0,40));\r\n      self.showToast('Image encoded! ' + self.fmtBytes(file.size));\r\n    };\r\n    reader.readAsDataURL(file);\r\n  },\r\n  previewB64Image: function(){\r\n    var inp = this.UI.imgDecInput ? this.UI.imgDecInput.value.trim() : '';\r\n    if(!inp){ this.showToast('Paste Base64 image code!','error'); return; }\r\n    var src = inp.startsWith('data:image') ? inp : 'data:image\/png;base64,' + inp;\r\n    var self = this;\r\n    if(this.UI.imgDecPreview){\r\n      this.UI.imgDecPreview.onload = function(){\r\n        if(self.UI.imgDecPreviewWrap) self.UI.imgDecPreviewWrap.style.display = 'block';\r\n        if(self.UI.imgDecDownloadBtn) self.UI.imgDecDownloadBtn.style.display = 'block';\r\n        self.showToast('Image previewed!');\r\n      };\r\n      this.UI.imgDecPreview.onerror = function(){ self.showToast('Invalid image data!','error'); };\r\n      this.UI.imgDecPreview.src = src;\r\n    }\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 FILE ENCODER \u2500\u2500\u2500 *\/\r\n  handleAnyFile: function(file){\r\n    if(!file) return;\r\n    var self = this;\r\n    if(this.UI.fileProgressWrap) this.UI.fileProgressWrap.style.display = 'block';\r\n    if(this.UI.fileProgressBar) this.UI.fileProgressBar.style.width = '10%';\r\n    var reader = new FileReader();\r\n    reader.onprogress = function(e){ if(e.lengthComputable && self.UI.fileProgressBar) self.UI.fileProgressBar.style.width = Math.round((e.loaded\/e.total)*70) + '%'; };\r\n    reader.onload = function(e){\r\n      if(self.UI.fileProgressBar) self.UI.fileProgressBar.style.width = '90%';\r\n      var dataUri = e.target.result;\r\n      if(self.UI.fileOutput) self.UI.fileOutput.value = dataUri;\r\n      var b64Len = dataUri.split(',')[1] ? dataUri.split(',')[1].length : 0;\r\n      if(self.UI.fileStats) self.UI.fileStats.style.display = 'flex';\r\n      if(self.UI.fileNameStat){ self.UI.fileNameStat.textContent = file.name.length > 15 ? file.name.substring(0,12)+'...' : file.name; }\r\n      if(self.UI.fileSizeStat) self.UI.fileSizeStat.textContent = self.fmtBytes(file.size);\r\n      if(self.UI.fileTypeStat) self.UI.fileTypeStat.textContent = file.type || 'unknown';\r\n      if(self.UI.fileB64SizeStat) self.UI.fileB64SizeStat.textContent = self.fmtBytes(b64Len);\r\n      if(self.UI.fileProgressBar) self.UI.fileProgressBar.style.width = '100%';\r\n      setTimeout(function(){ if(self.UI.fileProgressWrap) self.UI.fileProgressWrap.style.display='none'; }, 1000);\r\n      self.addHistory('FileEncode', file.name, dataUri.substring(0,40));\r\n      self.showToast(file.name + ' encoded!');\r\n    };\r\n    reader.readAsDataURL(file);\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 BATCH \u2500\u2500\u2500 *\/\r\n  runBatch: function(){\r\n    var inp = this.UI.batchInput ? this.UI.batchInput.value.trim() : '';\r\n    if(!inp){ this.showToast('Enter items (one per line)!','error'); return; }\r\n    var lines = inp.split('\\n').filter(function(l){ return l.trim(); });\r\n    if(!lines.length){ this.showToast('No lines found!','error'); return; }\r\n    var self = this;\r\n    this.batchResults = [];\r\n    lines.forEach(function(line){\r\n      var input = line.trim(), output = '';\r\n      try{\r\n        if(self.currentBatchMode === 'encode') output = self.encodeB64(input, false, false);\r\n        else output = self.decodeB64(input, true, true, true);\r\n        self.batchResults.push({input:input, output:output, ok:true});\r\n      } catch(e){ self.batchResults.push({input:input, output:'ERROR: '+e.message, ok:false}); }\r\n    });\r\n    this.renderBatchResults();\r\n    if(this.UI.batchCount) this.UI.batchCount.textContent = this.batchResults.length;\r\n    this.showToast(this.batchResults.length + ' items processed!');\r\n  },\r\n  renderBatchResults: function(){\r\n    if(!this.UI.batchResults) return;\r\n    var html = '';\r\n    this.batchResults.forEach(function(r,i){\r\n      html += '<div class=\"pth-batch-row\">'\r\n        + '<span style=\"font-size:.68rem;font-weight:800;color:#334155;min-width:22px;\">' + (i+1) + '<\/span>'\r\n        + '<span class=\"pth-batch-input-txt\" title=\"'+r.input+'\">'+r.input.substring(0,30)+(r.input.length>30?'..':'')+'<\/span>'\r\n        + '<span style=\"color:#334155;font-size:.8rem;padding:0 6px;\">\u2192<\/span>'\r\n        + '<span class=\"pth-batch-output-txt\" style=\"color:'+(r.ok?'#1d4ed8':'#dc2626')+'\">'+r.output.substring(0,60)+(r.output.length>60?'..':'')+'<\/span>'\r\n        + '<\/div>';\r\n    });\r\n    this.UI.batchResults.innerHTML = html;\r\n  },\r\n  downloadBatchCSV: function(){\r\n    if(!this.batchResults.length){ this.showToast('Run batch first!','error'); return; }\r\n    var csv = 'Input,Output\\n' + this.batchResults.map(function(r){ return '\"'+r.input.replace(\/\"\/g,'\"\"')+'\",\"'+r.output.replace(\/\"\/g,'\"\"')+'\"'; }).join('\\n');\r\n    this.download(csv, 'pth-batch-results.csv', 'text\/csv');\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 CSS\/HTML GENERATOR \u2500\u2500\u2500 *\/\r\n  generateSnippets: function(){\r\n    var b64 = this.UI.genB64Input ? this.UI.genB64Input.value.trim() : '';\r\n    if(!b64){ this.showToast('Paste or load a Base64 image!','error'); return; }\r\n    var src = b64.startsWith('data:') ? b64 : 'data:image\/png;base64,' + b64;\r\n    var mime = b64.startsWith('data:') ? b64.split(';')[0].replace('data:','') : 'image\/png';\r\n    if(this.UI.genCssOut) this.UI.genCssOut.value = '.pth-bg {\\n  background-image: url(\"' + src + '\");\\n  background-repeat: no-repeat;\\n  background-size: contain;\\n}';\r\n    if(this.UI.genHtmlOut) this.UI.genHtmlOut.value = '<img decoding=\"async\" src=\"' + src + '\" alt=\"Embedded image\" width=\"auto\" height=\"auto\" data-no-lazy=\"1\">';\r\n    if(this.UI.genFavOut) this.UI.genFavOut.value = '<link rel=\"icon\" type=\"' + mime + '\" href=\"' + src + '\">';\r\n    if(this.UI.genMdOut) this.UI.genMdOut.value = '![Embedded image](' + src + ')';\r\n    if(this.UI.genOutputs) this.UI.genOutputs.style.display = 'block';\r\n    this.showToast('Snippets generated!');\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 DIFF \u2500\u2500\u2500 *\/\r\n  runDiff: function(){\r\n    var a = this.UI.diffA ? this.UI.diffA.value.trim() : '';\r\n    var b = this.UI.diffB ? this.UI.diffB.value.trim() : '';\r\n    if(!a||!b){ this.showToast('Enter both strings!','error'); return; }\r\n    var aClean = a.replace(\/\\s+\/g,''), bClean = b.replace(\/\\s+\/g,'');\r\n    var match = aClean === bClean;\r\n    var firstDiff = -1;\r\n    var shorter = Math.min(aClean.length, bClean.length);\r\n    for(var i=0;i<shorter;i++){ if(aClean[i] !== bClean[i]){ firstDiff=i; break; } }\r\n    if(!match && firstDiff === -1) firstDiff = shorter;\r\n    if(this.UI.diffLenA) this.UI.diffLenA.textContent = aClean.length;\r\n    if(this.UI.diffLenB) this.UI.diffLenB.textContent = bClean.length;\r\n    if(this.UI.diffMatch){ this.UI.diffMatch.textContent = match?'\u2705 Match':'\u274c Differ'; this.UI.diffMatch.style.color = match?'#047857':'#dc2626'; }\r\n    if(this.UI.diffFirstDiff) this.UI.diffFirstDiff.textContent = match ? 'None' : 'pos ' + firstDiff;\r\n    if(this.UI.diffStats) this.UI.diffStats.style.display = 'flex';\r\n    if(this.UI.diffResult){\r\n      if(match){\r\n        this.UI.diffResult.innerHTML = '<div style=\"background:#ecfdf5;border:1px solid #6ee7b7;border-radius:8px;padding:14px;color:#047857;font-weight:700;text-align:center;font-size:.88rem;\">\u2705 Both strings are identical (ignoring whitespace)<\/div>';\r\n      } else {\r\n        var chunkSize = 60;\r\n        var html = '<div style=\"font-size:.72rem;font-weight:700;color:#334155;margin-bottom:6px;\">Character comparison (first 300 chars each):<\/div>';\r\n        var showLen = Math.min(300, Math.max(aClean.length, bClean.length));\r\n        for(var j=0;j<showLen;j+=chunkSize){\r\n          var chunkA = aClean.substring(j,j+chunkSize)||'';\r\n          var chunkB = bClean.substring(j,j+chunkSize)||'';\r\n          var same = chunkA === chunkB;\r\n          html += '<div class=\"' + (same?'pth-diff-eq':(j<=firstDiff&&firstDiff<j+chunkSize?'pth-diff-rem':'pth-diff-eq')) + '\"><span style=\"color:#64748b;font-size:.65rem;\">A:<\/span> ' + this.escHtml(chunkA) + '<\/div>';\r\n          if(!same) html += '<div class=\"pth-diff-add\"><span style=\"color:#64748b;font-size:.65rem;\">B:<\/span> ' + this.escHtml(chunkB) + '<\/div>';\r\n        }\r\n        this.UI.diffResult.innerHTML = html;\r\n      }\r\n    }\r\n    this.showToast(match ? 'Strings MATCH!' : 'Strings DIFFER at position ' + firstDiff, match ? 'success' : 'error');\r\n  },\r\n  escHtml: function(s){ return (s||'').replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;').replace(\/>\/g,'&gt;'); },\r\n\r\n  \/* \u2500\u2500\u2500 INSPECTOR \u2500\u2500\u2500 *\/\r\n  runInspect: function(){\r\n    var inp = this.UI.inspectInput ? this.UI.inspectInput.value.trim() : '';\r\n    if(!inp){ this.showToast('Enter a Base64 string!','error'); return; }\r\n    var clean = inp.replace(\/\\s+\/g,'');\r\n    var isDataUri = clean.startsWith('data:');\r\n    var mime = '', b64Only = clean;\r\n    if(isDataUri){ mime = clean.split(';')[0].replace('data:',''); b64Only = clean.split(',')[1]||''; }\r\n    var isValid = this.isValidB64(b64Only);\r\n    var isUrlSafe = \/[-_]\/.test(b64Only) && !\/[+\\\/]\/.test(b64Only);\r\n    var decoded = '', decLen = 0;\r\n    try{ decoded = this.decodeB64(b64Only, true, true, true); decLen = decoded.length; } catch(e){ decoded = '(could not decode)'; }\r\n    var rows = [\r\n      {k:'Length', v: clean.length + ' chars'},\r\n      {k:'Valid Base64', v: isValid ? '\u2705 Yes' : '\u274c No'},\r\n      {k:'URL Safe', v: isUrlSafe ? '\u2705 Yes (uses - _)' : '\u274c No (uses + \/)'},\r\n      {k:'Is Data URI', v: isDataUri ? '\u2705 Yes' : '\u274c No'},\r\n      {k:'MIME Type', v: mime || '\u2014'},\r\n      {k:'Has Padding', v: \/=+$\/.test(b64Only) ? '\u2705 Yes' : '\u274c No'},\r\n      {k:'Decoded length', v: decLen + ' bytes'},\r\n      {k:'Size increase', v: clean.length > 0 ? '+' + Math.round((clean.length\/decLen - 1)*100) + '%' : '\u2014'}\r\n    ];\r\n    if(this.UI.inspectRows){\r\n      var html = '';\r\n      rows.forEach(function(r){ html += '<div class=\"pth-inspect-row\"><span class=\"pth-inspect-key\">'+r.k+'<\/span><span class=\"pth-inspect-val\">'+r.v+'<\/span><\/div>'; });\r\n      this.UI.inspectRows.innerHTML = html;\r\n    }\r\n    if(this.UI.inspectDecoded) this.UI.inspectDecoded.value = decoded.substring(0,500) + (decoded.length>500?'\\n\\n[...truncated]':'');\r\n    if(isDataUri && mime.startsWith('image\/')){\r\n      if(this.UI.inspectImg){ this.UI.inspectImg.src = clean; }\r\n      if(this.UI.inspectPreviewWrap) this.UI.inspectPreviewWrap.style.display = 'block';\r\n    } else {\r\n      if(this.UI.inspectPreviewWrap) this.UI.inspectPreviewWrap.style.display = 'none';\r\n    }\r\n    if(this.UI.inspectResults) this.UI.inspectResults.style.display = 'block';\r\n    this.showToast('Inspection complete!');\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 HISTORY \u2500\u2500\u2500 *\/\r\n  addHistory: function(op, input, output){\r\n    this.history.unshift({op:op, input:input, output:output, time:new Date().toLocaleTimeString()});\r\n    if(this.history.length > 10) this.history.pop();\r\n    this.renderHistory();\r\n  },\r\n  renderHistory: function(){\r\n    if(!this.UI.historyList) return;\r\n    if(!this.history.length){\r\n      this.UI.historyList.innerHTML='<p style=\"font-size:.78rem;color:#334155;font-style:italic;text-align:center;margin:12px 0;\">No history yet.<\/p>';\r\n      if(this.UI.clearHistoryBtn) this.UI.clearHistoryBtn.style.display='none'; return;\r\n    }\r\n    if(this.UI.clearHistoryBtn) this.UI.clearHistoryBtn.style.display='block';\r\n    var html='';\r\n    this.history.forEach(function(h){\r\n      html+='<div class=\"pth-history-item\"><div class=\"pth-history-op\">'+h.op+'<\/div><div class=\"pth-history-val\">'+h.input+'<\/div><div style=\"font-size:.65rem;color:#64748b;margin-top:2px;\">'+h.time+'<\/div><\/div>';\r\n    });\r\n    this.UI.historyList.innerHTML = html;\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 EVENTS \u2500\u2500\u2500 *\/\r\n  attachEvents: function(){\r\n    var self = this;\r\n\r\n    \/* Layout *\/\r\n    this.bindEv(this.UI.fwBtn,'click',function(){\r\n      if(self.UI.layout){ self.UI.layout.classList.toggle('pth-fw'); self.UI.fwBtn.textContent=self.UI.layout.classList.contains('pth-fw')?'\u25c0 Split':'\u26f6 Full Width'; }\r\n    });\r\n    this.bindEv(this.UI.darkBtn,'click',function(){\r\n      if(self.UI.wrapper){ self.UI.wrapper.classList.toggle('pth-dark'); self.UI.darkBtn.textContent=self.UI.wrapper.classList.contains('pth-dark')?'\u2600\ufe0f Light':'\ud83c\udf19 Dark'; }\r\n    });\r\n    this.bindEv(this.UI.sampleBtn,'click',function(){\r\n      self.switchTab('encode');\r\n      if(self.UI.encInput) self.UI.encInput.value = 'Hello, PTH! \ud83d\udd21 Base64 Studio v3.0\\nSinhala: \u0d86\u0dba\u0dd4\u0db6\u0ddd\u0dc0\u0db1\u0dca\\nEmoji: \ud83d\ude80\ud83d\udd25\ud83d\udca1\\nSpecial: <html>\u00a9\u00ae\u2122';\r\n      self.runEncode();\r\n    });\r\n\r\n    \/* Tabs *\/\r\n    if(this.UI.tabBar){\r\n      this.UI.tabBar.querySelectorAll('.pth-tab-btn').forEach(function(btn){\r\n        btn.addEventListener('click', function(){ self.switchTab(btn.getAttribute('data-tab')); });\r\n      });\r\n    }\r\n\r\n    \/* Encode tab *\/\r\n    this.bindEv(this.UI.encBtn,'click',function(){ self.runEncode(); });\r\n    this.bindEv(this.UI.encInput,'input',function(){ if(self.UI.liveMode && self.UI.liveMode.checked && self.UI.encInput.value) self.runEncode(); });\r\n    this.bindEv(this.UI.encPasteBtn,'click',async function(){\r\n      try{ var t=await navigator.clipboard.readText(); if(self.UI.encInput) self.UI.encInput.value=t; self.showToast('Pasted!'); }\r\n      catch(e){ self.showToast('Clipboard denied','error'); }\r\n    });\r\n    this.bindEv(this.UI.encClearBtn,'click',function(){ if(self.UI.encInput) self.UI.encInput.value=''; if(self.UI.encOutput) self.UI.encOutput.value=''; if(self.UI.encStats) self.UI.encStats.style.display='none'; });\r\n    this.bindEv(this.UI.encCopyBtn,'click',function(){ if(self.UI.encOutput) self.copy(self.UI.encOutput.value,'Encoded string'); });\r\n    this.bindEv(this.UI.encDownloadBtn,'click',function(){ if(self.UI.encOutput&&self.UI.encOutput.value) self.download(self.UI.encOutput.value,'pth-encoded.txt'); });\r\n    this.bindEv(this.UI.encToDiffBtn,'click',function(){\r\n      if(self.UI.diffA&&self.UI.encOutput) self.UI.diffA.value=self.UI.encOutput.value;\r\n      self.switchTab('diff');\r\n      self.showToast('Sent to Diff tab!','info');\r\n    });\r\n    \/* Option chips for encode *\/\r\n    var encChips = [\r\n      [this.UI.urlSafe, this.UI.chipUrlsafe],\r\n      [this.UI.liveMode, this.UI.chipLive],\r\n      [this.UI.lineBreak, this.UI.chipLinebreak]\r\n    ];\r\n    encChips.forEach(function(pair){\r\n      if(pair[0]&&pair[1]) pair[0].addEventListener('change',function(){ pair[1].classList.toggle('active',pair[0].checked); });\r\n    });\r\n\r\n    \/* Decode tab *\/\r\n    this.bindEv(this.UI.decBtn,'click',function(){ self.runDecode(); });\r\n    this.bindEv(this.UI.decPasteBtn,'click',async function(){\r\n      try{ var t=await navigator.clipboard.readText(); if(self.UI.decInput) self.UI.decInput.value=t; self.showToast('Pasted!'); }\r\n      catch(e){ self.showToast('Clipboard denied','error'); }\r\n    });\r\n    this.bindEv(this.UI.decClearBtn,'click',function(){ if(self.UI.decInput) self.UI.decInput.value=''; if(self.UI.decOutput) self.UI.decOutput.value=''; if(self.UI.decStats) self.UI.decStats.style.display='none'; });\r\n    this.bindEv(this.UI.decCopyBtn,'click',function(){ if(self.UI.decOutput) self.copy(self.UI.decOutput.value,'Decoded text'); });\r\n    this.bindEv(this.UI.decDownloadBtn,'click',function(){ if(self.UI.decOutput&&self.UI.decOutput.value) self.download(self.UI.decOutput.value,'pth-decoded.txt'); });\r\n    this.bindEv(this.UI.decToEncBtn,'click',function(){\r\n      if(self.UI.encInput&&self.UI.decOutput) self.UI.encInput.value=self.UI.decOutput.value;\r\n      self.switchTab('encode'); self.runEncode();\r\n    });\r\n    var decChips = [\r\n      [this.UI.autoPad, this.UI.chipAutopad],\r\n      [this.UI.urlFix,  this.UI.chipUrlfx],\r\n      [this.UI.stripWs, this.UI.chipStripws]\r\n    ];\r\n    decChips.forEach(function(pair){\r\n      if(pair[0]&&pair[1]) pair[0].addEventListener('change',function(){ pair[1].classList.toggle('active',pair[0].checked); });\r\n    });\r\n\r\n    \/* Image tab *\/\r\n    this.bindEv(this.UI.imgDropZone,'click',function(){ if(self.UI.imgFile) self.UI.imgFile.click(); });\r\n    this.bindEv(this.UI.imgDropZone,'keydown',function(e){ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); if(self.UI.imgFile) self.UI.imgFile.click(); } });\r\n    this.bindEv(this.UI.imgFile,'change',function(e){ if(e.target.files[0]) self.handleImageFile(e.target.files[0]); if(self.UI.imgFile) self.UI.imgFile.value=''; });\r\n    this.bindEv(this.UI.imgDropZone,'dragover',function(e){ e.preventDefault(); self.UI.imgDropZone.classList.add('dragover'); });\r\n    this.bindEv(this.UI.imgDropZone,'dragleave',function(){ self.UI.imgDropZone.classList.remove('dragover'); });\r\n    this.bindEv(this.UI.imgDropZone,'drop',function(e){ e.preventDefault(); self.UI.imgDropZone.classList.remove('dragover'); if(e.dataTransfer.files[0]) self.handleImageFile(e.dataTransfer.files[0]); });\r\n    this.bindEv(this.UI.includeDataUri,'change',function(){ if(self.UI.chipDatauri) self.UI.chipDatauri.classList.toggle('active',self.UI.includeDataUri.checked); if(self.imgB64Cache){ var inc=self.UI.includeDataUri.checked; if(self.UI.imgEncOutput) self.UI.imgEncOutput.value=inc?self.imgB64Cache:self.imgB64Cache.split(',')[1]; } });\r\n    this.bindEv(this.UI.imgCopyBtn,'click',function(){ if(self.UI.imgEncOutput) self.copy(self.UI.imgEncOutput.value,'Image Base64'); });\r\n    this.bindEv(this.UI.imgDownloadBtn,'click',function(){ if(self.UI.imgEncOutput&&self.UI.imgEncOutput.value) self.download(self.UI.imgEncOutput.value,'pth-image-base64.txt'); });\r\n    this.bindEv(this.UI.imgToCssBtn,'click',function(){\r\n      if(self.UI.genB64Input&&self.UI.imgEncOutput) self.UI.genB64Input.value=self.UI.imgEncOutput.value;\r\n      self.switchTab('generator'); self.generateSnippets();\r\n    });\r\n    this.bindEv(this.UI.imgPreviewBtn,'click',function(){ self.previewB64Image(); });\r\n    this.bindEv(this.UI.imgDecDownloadBtn,'click',function(){\r\n      if(self.UI.imgDecPreview&&self.UI.imgDecPreview.src){\r\n        var a=document.createElement('a'); a.href=self.UI.imgDecPreview.src; a.download='pth-decoded-image.png'; a.click();\r\n      }\r\n    });\r\n\r\n    \/* File tab *\/\r\n    this.bindEv(this.UI.fileDropZone,'click',function(){ if(self.UI.anyFile) self.UI.anyFile.click(); });\r\n    this.bindEv(this.UI.fileDropZone,'keydown',function(e){ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); if(self.UI.anyFile) self.UI.anyFile.click(); } });\r\n    this.bindEv(this.UI.anyFile,'change',function(e){ if(e.target.files[0]) self.handleAnyFile(e.target.files[0]); if(self.UI.anyFile) self.UI.anyFile.value=''; });\r\n    this.bindEv(this.UI.fileDropZone,'dragover',function(e){ e.preventDefault(); self.UI.fileDropZone.classList.add('dragover'); });\r\n    this.bindEv(this.UI.fileDropZone,'dragleave',function(){ self.UI.fileDropZone.classList.remove('dragover'); });\r\n    this.bindEv(this.UI.fileDropZone,'drop',function(e){ e.preventDefault(); self.UI.fileDropZone.classList.remove('dragover'); if(e.dataTransfer.files[0]) self.handleAnyFile(e.dataTransfer.files[0]); });\r\n    this.bindEv(this.UI.fileCopyBtn,'click',function(){ if(self.UI.fileOutput) self.copy(self.UI.fileOutput.value,'File Base64'); });\r\n    this.bindEv(this.UI.fileDownloadBtn,'click',function(){ if(self.UI.fileOutput&&self.UI.fileOutput.value) self.download(self.UI.fileOutput.value,'pth-file-base64.txt'); });\r\n    this.bindEv(this.UI.fileClearBtn,'click',function(){ if(self.UI.fileOutput) self.UI.fileOutput.value=''; if(self.UI.fileStats) self.UI.fileStats.style.display='none'; });\r\n\r\n    \/* Batch tab *\/\r\n    document.querySelectorAll('#pth-panel-batch .pth-conv-btn').forEach(function(btn){\r\n      btn.addEventListener('click',function(){\r\n        document.querySelectorAll('#pth-panel-batch .pth-conv-btn').forEach(function(b){ b.classList.remove('active'); b.style.background='#f8fafc'; b.style.borderColor='#e2e8f0'; b.style.color='#334155'; b.setAttribute('aria-pressed','false'); });\r\n        btn.classList.add('active'); btn.style.background='#eff6ff'; btn.style.borderColor='#bfdbfe'; btn.style.color='#1d4ed8'; btn.setAttribute('aria-pressed','true');\r\n        self.currentBatchMode = btn.getAttribute('data-bmode');\r\n      });\r\n    });\r\n    this.bindEv(this.UI.batchRunBtn,'click',function(){ self.runBatch(); });\r\n    this.bindEv(this.UI.batchCsvBtn,'click',function(){ self.downloadBatchCSV(); });\r\n    this.bindEv(this.UI.batchClearBtn,'click',function(){ if(self.UI.batchInput) self.UI.batchInput.value=''; if(self.UI.batchResults) self.UI.batchResults.innerHTML=''; self.batchResults=[]; if(self.UI.batchCount) self.UI.batchCount.textContent='0'; });\r\n\r\n    \/* Generator tab *\/\r\n    this.bindEv(this.UI.genLoadBtn,'click',function(){ if(self.UI.genB64Input&&self.imgB64Cache){ self.UI.genB64Input.value=self.imgB64Cache; self.showToast('Loaded from Image tab!','info'); } else self.showToast('Encode an image first!','error'); });\r\n    this.bindEv(this.UI.genRunBtn,'click',function(){ self.generateSnippets(); });\r\n    this.bindEv(this.UI.genCopyCss,'click',function(){ if(self.UI.genCssOut) self.copy(self.UI.genCssOut.value,'CSS snippet'); });\r\n    this.bindEv(this.UI.genCopyHtml,'click',function(){ if(self.UI.genHtmlOut) self.copy(self.UI.genHtmlOut.value,'HTML snippet'); });\r\n    this.bindEv(this.UI.genCopyFav,'click',function(){ if(self.UI.genFavOut) self.copy(self.UI.genFavOut.value,'Favicon tag'); });\r\n    this.bindEv(this.UI.genCopyMd,'click',function(){ if(self.UI.genMdOut) self.copy(self.UI.genMdOut.value,'Markdown snippet'); });\r\n\r\n    \/* Diff tab *\/\r\n    this.bindEv(this.UI.diffRunBtn,'click',function(){ self.runDiff(); });\r\n\r\n    \/* Inspector tab *\/\r\n    this.bindEv(this.UI.inspectBtn,'click',function(){ self.runInspect(); });\r\n\r\n    \/* History *\/\r\n    this.bindEv(this.UI.clearHistoryBtn,'click',function(){ self.history=[]; self.renderHistory(); });\r\n\r\n    \/* Keyboard *\/\r\n    document.addEventListener('keydown',function(e){\r\n      var inEdit = document.activeElement&&(document.activeElement.tagName==='TEXTAREA'||document.activeElement.tagName==='INPUT');\r\n      if(e.ctrlKey&&e.key==='Enter'){ e.preventDefault(); if(self.currentTab==='encode') self.runEncode(); else if(self.currentTab==='decode') self.runDecode(); }\r\n      if(e.ctrlKey&&e.key.toLowerCase()==='f'&&!inEdit){ e.preventDefault(); if(self.UI.fwBtn) self.UI.fwBtn.click(); }\r\n    });\r\n  },\r\n\r\n  \/* \u2500\u2500\u2500 TABS \u2500\u2500\u2500 *\/\r\n  switchTab: function(tab){\r\n    this.currentTab = tab;\r\n    if(!this.UI.tabBar) return;\r\n    this.UI.tabBar.querySelectorAll('.pth-tab-btn').forEach(function(b){\r\n      var active = b.getAttribute('data-tab')===tab;\r\n      b.classList.toggle('active',active);\r\n      b.setAttribute('aria-selected',active?'true':'false');\r\n    });\r\n    ['encode','decode','image','file','batch','generator','diff','inspector'].forEach(function(p){\r\n      var el = document.getElementById('pth-panel-'+p);\r\n      if(el) el.classList.toggle('active',p===tab);\r\n    });\r\n  }\r\n};\r\n\r\nfunction runInit(){\r\n  if(!window.pthBase64StudioApp.initialized && document.getElementById('pth-b64-wrapper')){\r\n    window.pthBase64StudioApp.initialized = true;\r\n    window.pthBase64StudioApp.init();\r\n  }\r\n}\r\nrunInit();\r\ndocument.addEventListener('DOMContentLoaded', runInit);\r\nwindow.addEventListener('load', function(){ setTimeout(runInit, 50); });\r\nvar _pthB64MO = new MutationObserver(function(){ runInit(); });\r\n_pthB64MO.observe(document.body, {childList:true, subtree:true});\r\nsetTimeout(function(){ _pthB64MO.disconnect(); }, 10000);\r\n\r\n})();\r\n<\/script>\n\n\n\n\n<style>\n.pth-feature-wrap{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:20px;margin:32px 0}\n.pth-feat-box{background:#f8fafc;border:1px solid #e2e8f0;border-radius:14px;padding:22px 24px}\n.pth-feat-title{font-size:1.05rem;font-weight:800;color:#0f172a;margin:0 0 10px;display:flex;align-items:center;gap:8px}\n.pth-feat-text{font-size:0.92rem;color:#1e293b;font-weight:500;line-height:1.7;margin:0}\n.pth-steps-wrap{margin:36px 0}\n.pth-steps-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-top:16px}\n.pth-step-item{background:#ffffff;border:1px solid #e2e8f0;border-radius:12px;padding:18px 20px;display:flex;flex-direction:column;gap:8px}\n.pth-step-num{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#3b82f6,#1d4ed8);color:#fff;font-weight:900;font-size:0.95rem;display:flex;align-items:center;justify-content:center;flex-shrink:0}\n.pth-step-name{font-size:0.9rem;font-weight:800;color:#0f172a}\n.pth-step-desc{font-size:0.82rem;color:#334155;font-weight:500;line-height:1.6;margin:0}\n<\/style>\n \n<div class=\"pth-feature-wrap\">\n \n  <div class=\"pth-feat-box\">\n    <p class=\"pth-feat-title\">\ud83d\udfe2 8-Tab All-in-One Encoding Workspace<\/p>\n    <p class=\"pth-feat-text\">One tool, eight specialized workflows. The <strong>\ud83d\udcdd Encode<\/strong> tab offers live encoding as you type with <strong>\u26a1 Live<\/strong> mode, <strong>\ud83d\udd17 URL Safe<\/strong> output, and <strong>\ud83d\udccf Line Breaks (76)<\/strong> for MIME compliance. The <strong>\ud83d\udd13 Decode<\/strong> tab auto-normalizes URL-safe characters, strips whitespace, and adds missing padding before decoding \u2014 three toggles that cover every variant of Base64 found in the wild. Encoding overhead stats (input chars, output chars, size increase) update after every operation.<\/p>\n  <\/div>\n \n  <div class=\"pth-feat-box\">\n    <p class=\"pth-feat-title\">\ud83d\udd35 Image, File &amp; Batch Processing<\/p>\n    <p class=\"pth-feat-text\">The <strong>\ud83d\uddbc\ufe0f Image<\/strong> tab encodes and decodes images (PNG, JPG, SVG, WEBP, GIF up to 10MB) with side-by-side encode\/preview panels and a toggle for the <code>data:image\/<\/code> URI prefix. The <strong>\ud83d\udcc1 File Encoder<\/strong> tab accepts any file type \u2014 PDF, ZIP, audio, video \u2014 via drag &amp; drop and shows MIME type, file size, and Base64 output size. The <strong>\u26a1 Batch<\/strong> tab encodes or decodes multiple lines simultaneously and downloads all results as a two-column <strong>CSV<\/strong>.<\/p>\n  <\/div>\n \n  <div class=\"pth-feat-box\">\n    <p class=\"pth-feat-title\">\ud83d\udfe3 CSS\/HTML Generator, Diff &amp; Inspector<\/p>\n    <p class=\"pth-feat-text\">The <strong>\ud83c\udfa8 CSS\/HTML<\/strong> tab generates four ready-to-paste code snippets from any Base64 image: a <strong>CSS background<\/strong> rule, an <strong>HTML img tag<\/strong>, a <strong>favicon link tag<\/strong>, and a <strong>Markdown image<\/strong> \u2014 each with its own Copy button. The <strong>\ud83d\udcca Diff<\/strong> tab compares two Base64 strings and shows the exact character position of the first difference. The <strong>\ud83d\udd0d Inspector<\/strong> tab auto-detects whether a string is standard or URL-safe, checks for padding, identifies the MIME type, and previews the image if it is one.<\/p>\n  <\/div>\n \n<\/div>\n \n<div class=\"pth-steps-wrap\">\n  <h2 style=\"font-size:1.3rem;font-weight:800;color:#0f172a;margin:0 0 4px;\">How to Use the Base64 &amp; Encoding Studio<\/h2>\n  <p style=\"font-size:0.88rem;color:#334155;font-weight:500;margin:0 0 16px;\">Four steps from raw data to encoded, validated, and exported Base64 output.<\/p>\n  <div class=\"pth-steps-grid\">\n \n    <div class=\"pth-step-item\">\n      <div class=\"pth-step-num\">1<\/div>\n      <div class=\"pth-step-name\">Encode Text or Upload<\/div>\n      <p class=\"pth-step-desc\">In the <strong>\ud83d\udcdd Encode<\/strong> tab, type or paste any text \u2014 UTF-8, emoji, Sinhala, Arabic, or CJK all supported. Toggle <strong>\ud83d\udd17 URL Safe<\/strong> if the output will be used in a URL query parameter. Enable <strong>\u26a1 Live<\/strong> for real-time encoding on every keystroke. For images, go to <strong>\ud83d\uddbc\ufe0f Image<\/strong> and drag &amp; drop a PNG, JPG, SVG, WEBP, or GIF.<\/p>\n    <\/div>\n \n    <div class=\"pth-step-item\">\n      <div class=\"pth-step-num\">2<\/div>\n      <div class=\"pth-step-name\">Decode with Auto-Normalization<\/div>\n      <p class=\"pth-step-desc\">In the <strong>\ud83d\udd13 Decode<\/strong> tab, paste any Base64 string \u2014 URL-safe or standard, padded or unpadded. Keep <strong>\ud83d\udd27 Auto-Pad<\/strong>, <strong>\ud83d\udd17 URL Fix<\/strong>, and <strong>\ud83e\uddf9 Strip Spaces<\/strong> chips active. Click <strong>\ud83d\udd13 Decode Base64<\/strong>. For round-trip testing, click <strong>\u21ba Re-Encode<\/strong>. A validity badge confirms whether the input is valid Base64 before decoding. Click <strong>\u21ba Re-Encode<\/strong> to round-trip the decoded output back through the Encode tab.<\/p>\n    <\/div>\n \n    <div class=\"pth-step-item\">\n      <div class=\"pth-step-num\">3<\/div>\n      <div class=\"pth-step-name\">Generate CSS\/HTML Snippets<\/div>\n      <p class=\"pth-step-desc\">After encoding an image in the <strong>\ud83d\uddbc\ufe0f Image<\/strong> tab, click the <strong>\ud83c\udfa8 \u2192 CSS<\/strong> button \u2014 the tool loads your image Base64 into the <strong>\ud83c\udfa8 CSS\/HTML<\/strong> tab and generates four snippets instantly. Copy the <strong>CSS background<\/strong>, <strong>HTML img tag<\/strong>, <strong>Favicon link<\/strong>, or <strong>Markdown image<\/strong> with the individual Copy buttons, then paste directly into your stylesheet or HTML.<\/p>\n    <\/div>\n \n    <div class=\"pth-step-item\">\n      <div class=\"pth-step-num\">4<\/div>\n      <div class=\"pth-step-name\">Batch, Diff &amp; Inspect<\/div>\n      <p class=\"pth-step-desc\">For multiple items, go to <strong>\u26a1 Batch<\/strong>, enter one item per line, select Batch Encode or Batch Decode, click <strong>\u25b6 Run Batch<\/strong>, then <strong>\u2b07 CSV<\/strong> to download. To compare two Base64 strings, go to <strong>\ud83d\udcca Diff<\/strong> and click <strong>\ud83d\udcca Compare Strings<\/strong>. To analyze any unknown Base64 string, paste it in <strong>\ud83d\udd0d Inspector<\/strong> and click <strong>\ud83d\udd0d Inspect<\/strong>.<\/p>\n    <\/div>\n \n  <\/div>\n<\/div>\n \n\n\n\n<p class=\"wp-block-paragraph\">Last updated: June 2026<\/p>\n\n\n<!-- schoolictTool-il:535-1959 -->\n\n<p class=\"schoolictTool-il wp-block-paragraph\">Learn how it works: <a href=\"https:\/\/schoolict.net\/tools\/base64-encoder-and-decoder\/\">Base64 Encoding Explained for Everyday Web Work<\/a>.<\/p>\n\n<!-- \/schoolictTool-il:535-1959 -->\n\n\n<h2 id=\"\ud83d\udd34-why-a-basic-base-64-encoder-is-not-enough\" class=\"wp-block-heading\">\ud83d\udd34 Why a Basic Base64 Encoder Is Not Enough<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most Base64 tools online do exactly one thing: they call&nbsp;<code>btoa()<\/code>&nbsp;and display the result. This breaks immediately on any non-ASCII character \u2014 type an emoji, a Sinhala letter, or a Chinese character and you get either garbage output or a JavaScript error. Beyond that single limitation, real-world Base64 work covers at least eight distinct operations: encoding text, decoding strings, converting images, encoding arbitrary files, batch processing lists, generating CSS and HTML code snippets from image data, comparing two Base64 strings for differences, and inspecting an unknown Base64 string to determine what it contains. The PTH All-in-One Base64 and Encoding Studio v3.0 PRO addresses all eight in a single eight-tab workspace with no page reloads and no data transmission.<\/p>\n\n\n\n<h3 id=\"tab-1-\ud83d\udcdd-encode-utf-8-safe-with-live-mode\" class=\"wp-block-heading\">Tab 1 \u2014 \ud83d\udcdd Encode: UTF-8 Safe with Live Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Encode tab uses the browser&#8217;s&nbsp;<code>TextEncoder<\/code>&nbsp;API to convert input text to UTF-8 bytes before calling&nbsp;<code>btoa()<\/code>. This two-step process \u2014 text to bytes, bytes to Base64 \u2014 is the correct implementation for any text containing characters outside the ASCII range. The direct&nbsp;<code>btoa(string)<\/code>&nbsp;approach fails because&nbsp;<code>btoa()<\/code>&nbsp;expects a binary string where every character has a code point below 256, and multibyte Unicode characters violate this constraint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Encode tab also stores the last encoded output in session memory, making it available to the Diff and CSS\/HTML Generator tabs without re-encoding. Click&nbsp;<strong>\ud83d\udd21 Encode to Base64<\/strong>&nbsp;after entering text, then use the&nbsp;<strong>\u2192 Send to Diff<\/strong>&nbsp;shortcut to transfer the result directly. This cross-tab workflow is the fastest path from text input to comparative analysis \u2014 type, encode, compare, all without leaving the workspace or manually copying between panels.Three chip toggles control the output format.&nbsp;<strong>\u26a1 Live<\/strong>&nbsp;mode encodes on every keystroke \u2014 no button click needed.&nbsp;<strong>\ud83d\udd17 URL Safe<\/strong>&nbsp;replaces the two characters that break URL parsing:&nbsp;<code>+<\/code>&nbsp;becomes&nbsp;<code>-<\/code>&nbsp;and&nbsp;<code>\/<\/code>&nbsp;becomes&nbsp;<code>_<\/code>, and trailing&nbsp;<code>=<\/code>&nbsp;padding is removed. This produces the Base64URL variant defined in RFC 4648 Section 5.&nbsp;<strong>\ud83d\udccf Line Breaks (76)<\/strong>&nbsp;inserts a newline every 76 characters \u2014 the line length required by the MIME standard (RFC 2045) for Base64-encoded email attachments and multipart form data. Three stat chips show input character count, output character count, and the size increase percentage after each encode.<\/p>\n\n\n\n<h3 id=\"tab-2-\ud83d\udd13-decode-auto-normalization-before-decoding\" class=\"wp-block-heading\">Tab 2 \u2014 \ud83d\udd13 Decode: Auto-Normalization Before Decoding<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Base64 strings encountered in the wild come in several variants that cause&nbsp;<code>atob()<\/code>&nbsp;to throw errors without pre-processing. The Decode tab applies three normalization steps before decoding, each controlled by a toggle chip.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ud83e\uddf9 Strip Spaces<\/strong>&nbsp;removes all whitespace including newlines \u2014 essential for Base64 that was line-wrapped for MIME, copied from a certificate PEM block, or pasted from a formatted log entry.&nbsp;<strong>\ud83d\udd17 URL Fix<\/strong>&nbsp;converts URL-safe characters back to standard Base64:&nbsp;<code>-<\/code>&nbsp;becomes&nbsp;<code>+<\/code>&nbsp;and&nbsp;<code>_<\/code>&nbsp;becomes&nbsp;<code>\/<\/code>.&nbsp;<strong>\ud83d\udd27 Auto-Pad<\/strong>&nbsp;appends&nbsp;<code>=<\/code>&nbsp;characters until the string length is a multiple of four \u2014 required because many systems strip padding when storing or transmitting Base64. A validity badge confirms whether the input is valid Base64 before the decode attempt. The&nbsp;<strong>\u21ba Re-Encode<\/strong>&nbsp;button sends the decoded output back to the Encode tab for round-trip verification.<\/p>\n\n\n\n<h3 id=\"\ud83d\udfe1-tab-3-\ud83d\uddbc\ufe0f-image-encode-and-preview-side-by-side\" class=\"wp-block-heading\">\ud83d\udfe1 Tab 3 \u2014 \ud83d\uddbc\ufe0f Image: Encode and Preview Side by Side<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Image tab is a two-column layout that handles both directions simultaneously. The left column accepts PNG, JPG, SVG, WEBP, and GIF files up to 10 MB via drag &amp; drop or click-to-browse. The&nbsp;<code>FileReader.readAsDataURL()<\/code>&nbsp;method reads the file and returns a complete data URI \u2014&nbsp;<code>data:image\/png;base64,<\/code>&nbsp;followed by the Base64 payload. A progress bar tracks reading for large files. An&nbsp;<strong>Include data URI<\/strong>&nbsp;chip controls whether the output includes the&nbsp;<code>data:image\/<\/code>&nbsp;prefix or just the raw Base64 bytes \u2014 the prefix is needed for use in HTML and CSS, but some APIs expect the raw bytes only. A preview card shows the uploaded image, its filename, and file size.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The right column handles the reverse direction: paste a Base64 image string \u2014 with or without the data URI prefix \u2014 and click&nbsp;<strong>\ud83d\udc41\ufe0f Preview Image<\/strong>. If the prefix is missing, the tool prepends&nbsp;<code>data:image\/png;base64,<\/code>&nbsp;as a fallback. A&nbsp;<strong>\u2b07 Download Image<\/strong>&nbsp;button appears after a successful preview, saving the reconstructed image as a PNG file. The&nbsp;<strong>\ud83c\udfa8 \u2192 CSS<\/strong>&nbsp;button transfers the encoded image directly to the CSS\/HTML Generator tab and triggers snippet generation automatically.<\/p>\n\n\n\n<h3 id=\"tab-4-\ud83d\udcc1-file-encoder-any-file-type\" class=\"wp-block-heading\">Tab 4 \u2014 \ud83d\udcc1 File Encoder: Any File Type<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">While the Image tab is tailored for image workflows, the File Encoder tab accepts any file type \u2014 PDF documents, JSON data files, ZIP archives, MP3 audio, MP4 video, binary executables, or any other file the browser can read. The&nbsp;<code>FileReader.readAsDataURL()<\/code>&nbsp;call produces a data URI regardless of file type, with the MIME type auto-detected from the browser&#8217;s file type sniffing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Four stat chips appear after encoding: the file name (truncated for display), the original file size in human-readable format (B, KB, or MB), the detected MIME type, and the Base64 output size. Since Base64 adds approximately 33% overhead, a 1 MB PDF becomes roughly 1.33 MB of Base64 text. A progress bar with percentage feedback makes large file processing feel responsive. The full data URI output can be copied or downloaded as a&nbsp;<code>.txt<\/code>&nbsp;file for storage or transmission.<\/p>\n\n\n\n<h3 id=\"tab-5-\u26a1-batch-multiple-items-one-click\" class=\"wp-block-heading\">Tab 5 \u2014 \u26a1 Batch: Multiple Items, One Click<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Batch tab processes multiple items in a single operation. Enter one string per line in the input area \u2014 each line is independently encoded or decoded depending on the selected mode. The Batch Encode mode applies the same UTF-8 safe encoding as the Encode tab. The Batch Decode mode applies auto-padding, URL fix, and whitespace stripping before decoding each line.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Results appear as styled rows showing the original input and its output side by side, with the item count displayed in the panel header. The&nbsp;<strong>\u2b07 CSV<\/strong>&nbsp;button downloads a two-column CSV file named&nbsp;<code>pth-batch-results.csv<\/code>&nbsp;with headers&nbsp;<code>Input<\/code>&nbsp;and&nbsp;<code>Output<\/code>&nbsp;\u2014 ready to open in Excel or import into a data pipeline. This workflow replaces writing a loop in Python or Node.js for one-off batch encoding tasks.<\/p>\n\n\n\n<h3 id=\"\ud83d\udfe2-tab-6-\ud83c\udfa8-css-html-generator-four-code-snippets\" class=\"wp-block-heading\">\ud83d\udfe2 Tab 6 \u2014 \ud83c\udfa8 CSS\/HTML Generator: Four Code Snippets<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The CSS\/HTML Generator tab converts a Base64 image into four ready-to-use code snippets. Load a Base64 image from the Image tab using the&nbsp;<strong>\ud83d\udce5 Load from Image Tab<\/strong>&nbsp;button, or paste a data URI directly. Click&nbsp;<strong>\ud83c\udfa8 Generate Snippets<\/strong>&nbsp;and four output panels appear simultaneously.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<strong>CSS background<\/strong>&nbsp;snippet produces a&nbsp;<code>.pth-bg<\/code>&nbsp;rule with&nbsp;<code>background-image: url(\"data:...\")<\/code>,&nbsp;<code>background-repeat: no-repeat<\/code>, and&nbsp;<code>background-size: contain<\/code>&nbsp;\u2014 a complete starting point for embedding a background image without an HTTP request. The&nbsp;<strong>HTML img tag<\/strong>&nbsp;produces a complete&nbsp;<code>&lt;img&gt;<\/code>&nbsp;element with the&nbsp;<code>data-no-lazy=\"1\"<\/code>&nbsp;attribute included per PTH LiteSpeed standards. The&nbsp;<strong>Favicon link tag<\/strong>&nbsp;produces a&nbsp;<code>&lt;link rel=\"icon\"&gt;<\/code>&nbsp;element with the correct MIME type \u2014 for embedding a favicon directly in the HTML&nbsp;<code>&lt;head&gt;<\/code>&nbsp;without a separate&nbsp;<code>favicon.ico<\/code>&nbsp;file. The&nbsp;<strong>Markdown image<\/strong>&nbsp;produces&nbsp;<code>![Embedded image](data:...)<\/code>&nbsp;syntax for documentation and README files that support embedded images. Each snippet has its own individual Copy button.<\/p>\n\n\n\n<h3 id=\"tab-7-\ud83d\udcca-diff-compare-two-base-64-strings\" class=\"wp-block-heading\">Tab 7 \u2014 \ud83d\udcca Diff: Compare Two Base64 Strings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Diff tab takes two Base64 strings and compares them character by character after stripping whitespace from both. Four stat chips show the length of string A, the length of string B, whether they match or differ, and the exact position of the first differing character.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When strings match, a green confirmation panel confirms they are identical. When they differ, the comparison output shows 60-character chunks from both strings, color-coded with string A in red and string B in green \u2014 making it visually clear where the divergence begins. The&nbsp;<strong>\u2192 Send to Diff<\/strong>&nbsp;button in the Encode tab transfers the current encoded output to the Diff tab&#8217;s A field, enabling a common workflow: encode something, modify the input slightly, encode again, and compare the two outputs to verify the expected change.<\/p>\n\n\n\n<h3 id=\"tab-8-\ud83d\udd0d-inspector-decode-any-unknown-base-64\" class=\"wp-block-heading\">Tab 8 \u2014 \ud83d\udd0d Inspector: Decode Any Unknown Base64<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Inspector tab is for the common situation of encountering a Base64 string with no context \u2014 a field in a database, a value in a log file, a parameter in a URL \u2014 and needing to understand what it contains. Paste any Base64 string and click&nbsp;<strong>\ud83d\udd0d Inspect<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Eight properties are reported: total character length, validity (passes&nbsp;<code>atob()<\/code>&nbsp;without error), URL-safe detection (presence of&nbsp;<code>-<\/code>&nbsp;or&nbsp;<code>_<\/code>&nbsp;and absence of&nbsp;<code>+<\/code>&nbsp;or&nbsp;<code>\/<\/code>), data URI detection, extracted MIME type (if present), padding presence, decoded byte length, and size increase percentage. A decoded preview shows the first 500 characters of the decoded output \u2014 if the decoded content is text, it will be readable here. If the string is a data URI for an image, the image renders directly in the preview panel below the property list.<\/p>\n\n\n\n<h2 id=\"\ud83d\udd34-connected-workflows-between-tabs\" class=\"wp-block-heading\">\ud83d\udd34 Connected Workflows Between Tabs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Three cross-tab shortcuts eliminate manual copy-paste between tabs. The&nbsp;<strong>\u2192 Send to Diff<\/strong>&nbsp;button in the Encode tab copies the encoded output directly to the A field of the Diff tab and switches the view. The&nbsp;<strong>\ud83c\udfa8 \u2192 CSS<\/strong>&nbsp;button in the Image tab loads the encoded image into the CSS\/HTML Generator and triggers generation. The&nbsp;<strong>\u21ba Re-Encode<\/strong>&nbsp;button in the Decode tab sends decoded output back to the Encode tab for round-trip testing. All three workflows are one click from start to finish. For developer tools that work alongside Base64 encoding, see also the&nbsp;<a href=\"https:\/\/schoolict.net\/tools\/free-secure-hash-generator\/\">PTH Secure Hash and Crypto Studio<\/a>&nbsp;for SHA-256 and HMAC generation.<\/p>\n\n\n\n\n<style>\n.pth-faq-section{margin-top:50px;margin-bottom:40px;font-family:inherit}\n.pth-faq-header{font-size:1.8rem;font-weight:800;color:#0f172a;margin-bottom:25px;border-bottom:2px solid #e2e8f0;padding-bottom:10px;display:flex;align-items:center;gap:10px}\n.pth-faq-grid{display:grid;grid-template-columns:100%;gap:20px}\n@media(min-width:768px){.pth-faq-grid{grid-template-columns:repeat(2,1fr)}}\n@media(min-width:1024px){.pth-faq-grid{grid-template-columns:repeat(3,1fr)}}\n.pth-faq-card{background:#f8fafc;padding:24px;border-radius:12px;border:1px solid #e2e8f0;transition:transform .2s ease;break-inside:avoid}\n.pth-faq-card:hover{transform:translateY(-3px);box-shadow:0 4px 12px rgba(0,0,0,.05)}\n.pth-faq-q{color:#0f172a;font-size:1rem;font-weight:700;margin:0 0 12px;line-height:1.4}\n.pth-faq-a{margin:0;font-size:.95rem;color:#1e293b;line-height:1.6;font-weight:500}\n<\/style>\n \n<div class=\"pth-faq-section\">\n  <h2 class=\"pth-faq-header\">\u2753 Frequently Asked Questions<\/h2>\n  <div class=\"pth-faq-grid\">\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">Why does standard btoa() fail on emoji and Unicode?<\/p>\n      <p class=\"pth-faq-a\">The browser&#8217;s <code>btoa()<\/code> function expects a binary string where every character has a code point at or below 255. Unicode characters like emoji, Sinhala letters, or Chinese characters have code points above 255. This tool uses <code>TextEncoder<\/code> to convert the text to UTF-8 bytes first, then encodes the byte array \u2014 which always stays within the 0\u2013255 range required by <code>btoa()<\/code>.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">What is the difference between URL Safe and standard Base64?<\/p>\n      <p class=\"pth-faq-a\">Standard Base64 uses <code>+<\/code> and <code>\/<\/code> as the 62nd and 63rd characters, and <code>=<\/code> for padding. When embedded in a URL query parameter, <code>+<\/code> is interpreted as a space and <code>\/<\/code> breaks path parsing. URL Safe Base64 (Base64URL, RFC 4648 \u00a75) replaces these: <code>+<\/code> becomes <code>-<\/code>, <code>\/<\/code> becomes <code>_<\/code>, and trailing <code>=<\/code> padding is removed. Enable the <strong>\ud83d\udd17 URL Safe<\/strong> chip when the output will be used in a URL, HTTP header, or filename.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">How does the Decode tab handle missing padding?<\/p>\n      <p class=\"pth-faq-a\">Base64 strings must have a length that is a multiple of four. Many systems strip the trailing <code>=<\/code> padding characters when storing or transmitting Base64. The <strong>\ud83d\udd27 Auto-Pad<\/strong> chip re-adds the necessary padding before calling <code>atob()<\/code>. It appends <code>=<\/code> characters in a loop until the string length modulo 4 equals zero \u2014 which may add one or two characters depending on the original length.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">Can I encode files larger than images?<\/p>\n      <p class=\"pth-faq-a\">Yes. The <strong>\ud83d\udcc1 File Encoder<\/strong> tab accepts any file type \u2014 PDF, ZIP, MP3, MP4, binary files \u2014 with no restriction on file type. The practical limit is your browser&#8217;s available RAM, since the entire file is loaded into memory as a data URI. Very large files (50+ MB) may be slow on older devices. The output data URI can be copied or downloaded as a text file.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">What does the \ud83d\udccf Line Breaks (76) option do?<\/p>\n      <p class=\"pth-faq-a\">The MIME standard (RFC 2045) requires Base64-encoded content in emails to have a newline every 76 characters. Without line breaks, some email clients truncate or reject the encoded content. Enable <strong>\ud83d\udccf Line Breaks (76)<\/strong> when generating Base64 for email attachments, multipart form data, or any context that requires MIME-compliant Base64 formatting.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">How does the Diff tab detect where two strings diverge?<\/p>\n      <p class=\"pth-faq-a\">After stripping whitespace from both strings, the Diff tab compares them character by character in a loop, stopping at the first index where they differ. That index is the &#8220;First diff at&#8221; position shown in the stat chips. The output panel then displays 60-character chunks from both strings around the divergence point, making it possible to see exactly which characters changed.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">What does the Inspector report for an unknown Base64 string?<\/p>\n      <p class=\"pth-faq-a\">The Inspector reports eight properties: character length, validity, URL-safe detection, data URI presence, MIME type (from the data URI prefix if present), padding presence, decoded byte length, and size increase percentage. It also shows the first 500 characters of the decoded content and renders an image preview if the string is a Base64-encoded image data URI.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">Can I use the CSS\/HTML Generator for any Base64 image?<\/p>\n      <p class=\"pth-faq-a\">Yes. Load an image through the Image tab and click <strong>\ud83c\udfa8 \u2192 CSS<\/strong>, or paste any Base64 image data URI directly into the CSS\/HTML Generator tab and click <strong>\ud83c\udfa8 Generate Snippets<\/strong> \u2014 or use the <strong>\ud83d\udce5 Load from Image Tab<\/strong> shortcut. The generator detects the MIME type from the data URI prefix to set the correct <code>type<\/code> attribute in the favicon link tag. All four snippets are generated simultaneously.<\/p>\n    <\/div>\n \n    <div class=\"pth-faq-card\">\n      <p class=\"pth-faq-q\">Is there a limit on Batch tab item count?<\/p>\n      <p class=\"pth-faq-a\">There is no enforced limit. The batch processor loops through all non-empty lines and processes each one. Performance stays fast for hundreds of items since the encode and decode operations are synchronous. For very large batches (thousands of lines), consider processing in sub-batches of 500 at a time to avoid UI freezing on lower-spec devices.<\/p>\n    <\/div>\n \n  <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Free Base64 Encoder, Decoder &amp; Image Converter The ultimate offline Base64 utility. Instantly encode\/decode text with UTF-8 support, convert images to Base64 strings, or decode Base64 back to images. 100% free and secure. \ud83d\udfe2 8-Tab All-in-One Encoding Workspace One tool, eight specialized workflows. The \ud83d\udcdd Encode tab offers live encoding as you type with \u26a1 &#8230; <a title=\"Free Base64 Encoder Decoder &amp; Image Converter\" class=\"read-more\" href=\"https:\/\/schoolict.net\/tools\/free-base64-encoder-decoder-utf-8-supported\/\" aria-label=\"Read more about Free Base64 Encoder Decoder &amp; Image Converter\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":6047,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-535","page","type-page","status-publish","has-post-thumbnail"],"_links":{"self":[{"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/pages\/535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":1,"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/pages\/535\/revisions"}],"predecessor-version":[{"id":7238,"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/pages\/535\/revisions\/7238"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/media\/6047"}],"wp:attachment":[{"href":"https:\/\/schoolict.net\/tools\/wp-json\/wp\/v2\/media?parent=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}