{"id":48901,"date":"2026-01-10T22:26:40","date_gmt":"2026-01-10T14:26:40","guid":{"rendered":"https:\/\/www.geobok.com\/geo-toolkit\/token-density-checker\/"},"modified":"2026-04-03T11:00:20","modified_gmt":"2026-04-03T03:00:20","slug":"token-density-checker","status":"publish","type":"page","link":"https:\/\/www.geobok.com\/en\/geo-toolkit\/token-density-checker\/","title":{"rendered":"Token Density Checker"},"content":{"rendered":"\n<style>\n\/* ===== \u672c\u5de5\u5177\u7279\u6709\u6837\u5f0f\uff1a\u5bc6\u5ea6\u8bc4\u5206\u5361\u3001\u6bd4\u4f8b\u6761\u3001\u6570\u636e\u5361\u7247 ===== *\/\n.score-card { text-align: center; margin-bottom: 40px; padding: 40px; background: linear-gradient(180deg, var(--geo-bg-page) 0%, #fff 100%); border-radius: var(--geo-radius-xl); border: 1px solid var(--geo-border); }\n.density-value { font-size: 72px; font-weight: 800; color: var(--geo-primary); line-height: 1; margin-bottom: 12px; letter-spacing: -2px; }\n.density-label { font-size: 13px; color: var(--geo-text-muted); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }\n.density-grade { display: inline-block; margin-top: 20px; padding: 6px 18px; border-radius: var(--geo-radius-pill); font-size: 14px; font-weight: 700; }\n\n.bar-container { height: 12px; background: var(--geo-border); border-radius: 6px; overflow: hidden; display: flex; margin-bottom: 10px; }\n.bar-fill { height: 100%; background: linear-gradient(90deg, var(--geo-primary), #3b82f6); transition: width 1s ease; }\n.bar-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--geo-text-faint); margin-bottom: 30px; }\n\n.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }\n.metric-box { background: #fff; border: 1px solid var(--geo-border); box-shadow: var(--geo-shadow-sm); padding: 24px; border-radius: var(--geo-radius-lg); transition: transform 0.2s; }\n.metric-box:hover { transform: translateY(-2px); box-shadow: var(--geo-shadow-md); }\n.metric-title { font-size: 12px; color: var(--geo-text-muted); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }\n.metric-num { font-size: 28px; font-weight: 700; color: var(--geo-text-primary); letter-spacing: -0.5px; }\n.metric-desc { font-size: 13px; color: var(--geo-text-faint); margin-top: 4px; }\n\n.density-tip { margin-top: 25px; padding: 16px; background: #fff7ed; border-radius: 12px; font-size: 14px; color: #c2410c; display: none; line-height: 1.6; }\n\n@media (max-width: 640px) {\n    .metrics-grid { grid-template-columns: 1fr; }\n    .density-value { font-size: 56px; }\n}\n<\/style>\n\n<div class=\"geo-card\">\n    <div class=\"geo-hero\">\n        <h2 class=\"geo-hero__title\">\ud83e\uddec Token Density Analyzer<\/h2>\n        <p class=\"geo-hero__desc\">Analyze token efficiency \u2014 identify redundant tokens and improve AI indexing and recall.<\/p>\n    \n<div class=\"geo-about\">\n    <details class=\"geo-about__section\">\n        <summary>\ud83d\udcd6 What does this tool measure?<\/summary>\n        <div class=\"geo-about__body\">\n            <p>Every character on your page \u2014 including invisible HTML, CSS, and JavaScript \u2014 gets converted to tokens that eat into AI's context window. This tool gives you a fast read on your page's information purity: raw HTML tokens vs. clean-text tokens.<\/p>\n            <p class=\"geo-about__ref\">See <em>Make AI Speak for You: The Definitive Guide to GEO<\/em>, Ch. 2.2<\/p>\n        <\/div>\n    <\/details>\n    <details class=\"geo-about__section\">\n        <summary>\u2753 FAQ: GEO Impact<\/summary>\n        <div class=\"geo-about__body\">\n            <div class=\"geo-faq-item\"><h4>Why does token density matter for GEO?<\/h4><p>AI's context window is finite. Higher SNR means more of that window goes to your actual content, giving your page a competitive edge.<\/p><\/div>\n            <div class=\"geo-faq-item\"><h4>How is this different from the full AI Visibility Analysis?<\/h4><p>This is the lightweight version \u2014 SNR only, no Lighthouse, no screenshots, done in 5-10 seconds. The full analysis takes 60-120 seconds.<\/p><\/div>\n            <div class=\"geo-faq-item\"><h4>What if my SNR is low?<\/h4><p>Look for bloated inline CSS\/JS, deeply nested div wrappers, and uncompressed third-party scripts. Isolating content inside an article tag helps.<\/p><\/div>\n        <\/div>\n    <\/details>\n<\/div>\n<script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Why does token density matter for GEO?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"AI's context window is finite. Higher SNR means more of that window goes to your actual content, giving your page a competitive edge.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"How is this different from the full AI Visibility Analysis?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"This is the lightweight version \u2014 SNR only, no Lighthouse, no screenshots, done in 5-10 seconds. The full analysis takes 60-120 seconds.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"What if my SNR is low?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Look for bloated inline CSS\/JS, deeply nested div wrappers, and uncompressed third-party scripts. Isolating content inside an article tag helps.\"\n      }\n    }\n  ]\n}\n<\/script>\n\n<\/div>\n\n    <div class=\"geo-action\">\n        <div class=\"geo-input-row\">\n            <input type=\"url\" id=\"density-url\" class=\"geo-input\" placeholder=\"Enter a URL (e.g. https:\/\/example.com)...\">\n            <button id=\"density-btn\" class=\"geo-btn\">Start analysis<\/button>\n        <\/div>\n    <\/div>\n\n    <!-- \u8fdb\u5ea6\u6761 -->\n    <div class=\"geo-progress\" id=\"density-loader\">\n        <div class=\"geo-progress__track\"><div id=\"density-pbar\" class=\"geo-progress__bar\"><\/div><\/div>\n        <div id=\"density-ptext\" class=\"geo-progress__text\">' + GeoAPI.t('density.s1') + '<\/div>\n    <\/div>\n\n    <!-- \u7ed3\u679c -->\n    <div id=\"density-result\" class=\"geo-result\" style=\"padding: 0 var(--geo-space-xl) var(--geo-space-xl);\">\n        <div class=\"score-card\">\n            <div class=\"density-value\" id=\"res-density\">0%<\/div>\n            <div class=\"density-label\">Token \u5bc6\u5ea6 (\u6709\u6548\u4fe1\u606f\u5360\u6bd4)<\/div>\n            <div id=\"res-grade\" class=\"density-grade\" style=\"background:var(--geo-bg-page);color:var(--geo-text-muted);\">\u7b49\u5f85\u5206\u6790<\/div>\n        <\/div>\n\n        <div style=\"margin-bottom:12px;font-size:14px;font-weight:600;color:var(--geo-text-primary);\">\u6210\u5206\u900f\u89c6\uff1a<\/div>\n        <div class=\"bar-container\"><div id=\"res-bar\" class=\"bar-fill\" style=\"width:0%\"><\/div><\/div>\n        <div class=\"bar-legend\"><span id=\"res-clean-legend\">\u6709\u6548\u5185\u5bb9: 0%<\/span><span>HTML\/JS \u4ee3\u7801\u566a\u97f3<\/span><\/div>\n\n        <div class=\"metrics-grid\">\n            <div class=\"metric-box\">\n                <div class=\"metric-title\">\ud83d\udce6 \u539f\u59cb\u4f53\u79ef (Raw Tokens)<\/div>\n                <div class=\"metric-num\" id=\"res-raw\">0<\/div>\n                <div class=\"metric-desc\">\u672a\u6e05\u6d17\u7684 HTML \u4ee3\u7801\u603b\u6d88\u8017<\/div>\n            <\/div>\n            <div class=\"metric-box\">\n                <div class=\"metric-title\">\ud83d\udc8e \u7eaf\u51c0\u4f53\u79ef (Clean Tokens)<\/div>\n                <div class=\"metric-num\" id=\"res-clean\">0<\/div>\n                <div class=\"metric-desc\">AI \u5b9e\u9645\u53ef\u8bfb\u53d6\u7684\u77e5\u8bc6\u51c0\u8377<\/div>\n            <\/div>\n        <\/div>\n\n        <div class=\"density-tip\" id=\"density-tip\">\u26a0\ufe0f <strong>\u5bc6\u5ea6\u8fc7\u4f4e\uff1a<\/strong> \u5efa\u8bae\u7cbe\u7b80 HTML \u7ed3\u6784\u3001\u5c06 CSS\/JS \u5916\u7f6e\uff0c\u6216\u589e\u52a0\u6b63\u6587\u6587\u672c\u957f\u5ea6\uff0c\u4ee5\u63d0\u5347 AI \u6293\u53d6\u6548\u7387\u3002<\/div>\n    <\/div>\n<\/div>\n\n<script>\ndocument.addEventListener('DOMContentLoaded', function(){\n    var btn = document.getElementById('density-btn');\n    var progress = GeoAPI.initProgress(document.getElementById('density-pbar'), document.getElementById('density-ptext'));\n    var resultArea = document.getElementById('density-result');\n    var tipBox = document.getElementById('density-tip');\n    var progressInterval;\n\n    function startProgress(){\n        var w=0; progress.show(); progress.update(0,'');\n        if(progressInterval) clearInterval(progressInterval);\n        progressInterval = setInterval(function(){\n            if(w<30){ w+=2; progress.update(w, GeoAPI.t('density.s1')); }\n            else if(w<70){ w+=0.5; progress.update(w, GeoAPI.t('density.s2')); }\n            else if(w<90){ w+=0.1; progress.update(w, GeoAPI.t('density.s3')); }\n        },50);\n    }\n\n    btn.addEventListener('click', async function(){\n        var url = document.getElementById('density-url').value.trim();\n        if(!url.startsWith('http')){ alert('\u8bf7\u8f93\u5165\u5b8c\u6574\u7684 URL'); return; }\n\n        GeoAPI.disableBtn(btn, GeoAPI.t('btn.analyzing'));\n        resultArea.style.display='none'; resultArea.classList.remove('geo-result--visible');\n        tipBox.style.display='none';\n        startProgress();\n\n        try {\n            var data = await GeoAPI.post('\/geo\/token-density',{url:url},{timeout:30000});\n            var raw=data.raw_tokens||0, clean=data.clean_tokens||0;\n            var density = data.snr ? parseFloat(data.snr).toFixed(1) : (raw>0?(clean\/raw*100).toFixed(1):'0');\n\n            var gradeText, gradeBg, gradeColor;\n            if(density>=40){ gradeText='\ud83c\udf1f \u6781\u4f73 (AI Friendly)'; gradeBg='var(--geo-success-bg)'; gradeColor='#15803d'; }\n            else if(density>=15){ gradeText='\u2705 \u826f\u597d (Standard)'; gradeBg='#ccfbf1'; gradeColor='#1e40af'; }\n            else { gradeText='\u26a0\ufe0f \u81c3\u80bf (Bloated)'; gradeBg='var(--geo-danger-bg)'; gradeColor='#b91c1c'; tipBox.style.display='block'; }\n\n            document.getElementById('res-density').innerText = density+'%';\n            var gradeEl=document.getElementById('res-grade');\n            gradeEl.innerText=gradeText; gradeEl.style.background=gradeBg; gradeEl.style.color=gradeColor;\n            document.getElementById('res-raw').innerText = GeoAPI.formatNumber(raw);\n            document.getElementById('res-clean').innerText = GeoAPI.formatNumber(clean);\n            document.getElementById('res-bar').style.width = Math.min(density,100)+'%';\n            document.getElementById('res-clean-legend').innerText = '\u6709\u6548\u5185\u5bb9: '+density+'%';\n\n            clearInterval(progressInterval); progress.update(100, GeoAPI.t('result.done'));\n            setTimeout(function(){ progress.hide(); resultArea.style.display='block'; resultArea.classList.add('geo-result--visible'); },500);\n        } catch(e){\n            clearInterval(progressInterval); progress.hide();\n            if(!e._geoAuthHandled) alert('\u5206\u6790\u5931\u8d25: '+e.message);\n        } finally { GeoAPI.enableBtn(btn,'\u5f00\u59cb\u68c0\u6d4b'); }\n    });\n});\n<\/script>\n\n        \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":48884,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-48901","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/pages\/48901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/comments?post=48901"}],"version-history":[{"count":0,"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/pages\/48901\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/pages\/48884"}],"wp:attachment":[{"href":"https:\/\/www.geobok.com\/en\/wp-json\/wp\/v2\/media?parent=48901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}