{"id":14969,"date":"2026-02-17T14:48:08","date_gmt":"2026-02-17T14:48:08","guid":{"rendered":"https:\/\/securedinspectionservices.com\/?page_id=14969"},"modified":"2026-02-17T19:23:32","modified_gmt":"2026-02-17T19:23:32","slug":"aql-sample-size-calculator","status":"publish","type":"page","link":"https:\/\/securedinspectionservices.com\/?page_id=14969","title":{"rendered":"Aql Sample Size Calculator"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"14969\" class=\"elementor elementor-14969\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4d9629e e-flex e-con-boxed e-con e-parent\" data-id=\"4d9629e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6f51707 elementor-widget elementor-widget-html\" data-id=\"6f51707\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n    <title>AQL complete suite \u00b7 sampling plans, OC curves, limits (ANSI\/ASQ Z1.4)<\/title>\r\n    <style>\r\n        * {\r\n            box-sizing: border-box;\r\n            font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\r\n        }\r\n        body {\r\n            background: #e8f0f9;\r\n            margin: 20px;\r\n            display: flex;\r\n            justify-content: center;\r\n            align-items: center;\r\n            min-height: calc(100vh - 40px);\r\n        }\r\n        .master-card {\r\n            max-width: 1400px;\r\n            width: 100%;\r\n            background: white;\r\n            border-radius: 40px;\r\n            box-shadow: 0 30px 60px -20px rgba(8, 40, 70, 0.4);\r\n            overflow: hidden;\r\n        }\r\n        .header {\r\n            background: linear-gradient(145deg, #0b2d4f, #123b61);\r\n            color: white;\r\n            padding: 2rem 3rem;\r\n        }\r\n        .header h1 {\r\n            margin: 0;\r\n            font-weight: 500;\r\n            font-size: 2.2rem;\r\n            display: flex;\r\n            align-items: center;\r\n            gap: 16px;\r\n            flex-wrap: wrap;\r\n        }\r\n        .header h1 span {\r\n            background: #1f5885;\r\n            font-size: 1rem;\r\n            font-weight: 400;\r\n            padding: 0.3rem 1.3rem;\r\n            border-radius: 40px;\r\n            letter-spacing: 0.2px;\r\n        }\r\n        .header p {\r\n            margin: 10px 0 0;\r\n            opacity: 0.8;\r\n            font-size: 1rem;\r\n        }\r\n        .control-ribbon {\r\n            background: white;\r\n            padding: 1.5rem 3rem;\r\n            display: flex;\r\n            flex-wrap: wrap;\r\n            gap: 2.5rem 3.5rem;\r\n            align-items: flex-end;\r\n            border-bottom: 1px solid #cbddee;\r\n        }\r\n        .control-group {\r\n            display: flex;\r\n            flex-direction: column;\r\n            gap: 6px;\r\n            min-width: 190px;\r\n        }\r\n        .control-group label {\r\n            font-weight: 600;\r\n            font-size: 0.8rem;\r\n            text-transform: uppercase;\r\n            letter-spacing: 0.5px;\r\n            color: #1f4a72;\r\n        }\r\n        .control-group select, .control-group input {\r\n            background: #f2f8ff;\r\n            border: 1px solid #b7cfec;\r\n            border-radius: 40px;\r\n            padding: 12px 20px;\r\n            font-size: 1rem;\r\n            font-weight: 500;\r\n            color: #0d3453;\r\n            outline: none;\r\n            transition: 0.2s;\r\n        }\r\n        .control-group select:focus, .control-group input:focus {\r\n            border-color: #1f6fb0;\r\n            box-shadow: 0 0 0 3px rgba(24, 100, 170, 0.15);\r\n            background: #ffffff;\r\n        }\r\n        .code-chip {\r\n            background: #e2edfb;\r\n            border-radius: 40px;\r\n            padding: 8px 26px;\r\n            font-size: 1.2rem;\r\n            font-weight: 600;\r\n            color: #0f3f64;\r\n            display: flex;\r\n            align-items: center;\r\n            gap: 12px;\r\n            white-space: nowrap;\r\n        }\r\n        .code-chip span {\r\n            background: white;\r\n            padding: 6px 24px;\r\n            border-radius: 40px;\r\n            font-size: 1.6rem;\r\n            font-weight: 700;\r\n            color: #052c48;\r\n            box-shadow: inset 0 1px 4px #cddbe9;\r\n        }\r\n        .tab-section {\r\n            padding: 1rem 3rem 0 3rem;\r\n            background: white;\r\n        }\r\n        .tabs {\r\n            display: flex;\r\n            gap: 10px;\r\n            flex-wrap: wrap;\r\n            border-bottom: 2px solid #cfdfef;\r\n            padding-bottom: 2px;\r\n        }\r\n        .tab-btn {\r\n            background: transparent;\r\n            border: none;\r\n            padding: 12px 28px;\r\n            font-size: 1rem;\r\n            font-weight: 600;\r\n            color: #3c5d82;\r\n            border-radius: 30px 30px 0 0;\r\n            cursor: pointer;\r\n            transition: 0.15s;\r\n            margin-bottom: -2px;\r\n            border-bottom: 3px solid transparent;\r\n        }\r\n        .tab-btn.active {\r\n            color: #073457;\r\n            border-bottom: 3px solid #1e6eb5;\r\n            background: #ecf5fd;\r\n        }\r\n        .tab-content {\r\n            display: none;\r\n            padding: 2.5rem 0 2rem 0;\r\n        }\r\n        .tab-content.active {\r\n            display: block;\r\n        }\r\n        .table-wrapper {\r\n            overflow-x: auto;\r\n            border-radius: 24px;\r\n            box-shadow: 0 8px 22px rgba(2, 30, 60, 0.08);\r\n        }\r\n        table {\r\n            width: 100%;\r\n            border-collapse: collapse;\r\n            background: white;\r\n            font-size: 0.95rem;\r\n        }\r\n        th {\r\n            background: #dde9f5;\r\n            color: #0e3451;\r\n            font-weight: 600;\r\n            font-size: 0.8rem;\r\n            text-transform: uppercase;\r\n            padding: 18px 12px;\r\n            border-bottom: 2px solid #b3cde5;\r\n            text-align: center;\r\n        }\r\n        td {\r\n            padding: 16px 12px;\r\n            border-bottom: 1px solid #d7e5f3;\r\n            text-align: center;\r\n            color: #1a3f5c;\r\n        }\r\n        .ac-rej-badge {\r\n            display: inline-flex;\r\n            gap: 16px;\r\n            background: #f2f9ff;\r\n            padding: 5px 20px;\r\n            border-radius: 40px;\r\n            font-weight: 500;\r\n        }\r\n        .ac { color: #19764b; }\r\n        .rej { color: #b3403a; }\r\n        .divider { color: #8faac9; }\r\n        .missing { color: #768ea8; font-style: italic; background: #f0f6fe; padding: 4px 14px; border-radius: 30px; }\r\n        .footnote {\r\n            background: #e9f2fa;\r\n            padding: 1.5rem 3rem;\r\n            display: flex;\r\n            flex-wrap: wrap;\r\n            justify-content: space-between;\r\n            align-items: center;\r\n            font-size: 0.9rem;\r\n            color: #25547b;\r\n        }\r\n        .curves-container {\r\n            display: flex;\r\n            flex-wrap: wrap;\r\n            gap: 2rem;\r\n            justify-content: center;\r\n        }\r\n        .oc-card {\r\n            background: #f6fafe;\r\n            border-radius: 32px;\r\n            padding: 1.8rem;\r\n            flex: 1 1 280px;\r\n            box-shadow: 0 6px 16px rgba(0,35,70,0.05);\r\n        }\r\n        .oc-card h3 {\r\n            margin-top: 0;\r\n            color: #153e5e;\r\n            font-weight: 500;\r\n            border-bottom: 2px dotted #afc9e3;\r\n            padding-bottom: 12px;\r\n        }\r\n        .oc-value {\r\n            font-size: 1.3rem;\r\n            background: white;\r\n            padding: 10px 18px;\r\n            border-radius: 60px;\r\n            display: inline-block;\r\n            margin: 5px 0;\r\n        }\r\n        .mini-table {\r\n            width: 100%;\r\n            font-size: 0.9rem;\r\n        }\r\n        .mini-table td {\r\n            padding: 10px 6px;\r\n            background: transparent;\r\n            border-bottom: 1px solid #cbdef2;\r\n        }\r\n        .aql-highlight {\r\n            background: #fff3cf;\r\n            font-weight: 700;\r\n        }\r\n        .reset-link {\r\n            color: #1d5d8e;\r\n            text-decoration: none;\r\n            border-bottom: 1px dashed;\r\n            cursor: pointer;\r\n        }\r\n    <\/style>\r\n<\/head>\r\n<body>\r\n<div class=\"master-card\">\r\n    <div class=\"header\">\r\n        <h1>\r\n            \u2699\ufe0f AQL complete suite <span>ANSI\/ASQ Z1.4 \/ ISO 2859-1<\/span>\r\n        <\/h1>\r\n        <p>Single sampling (normal) \u00b7 master table II-A \u00b7 OC curves & sampling limits<\/p>\r\n    <\/div>\r\n\r\n    <div class=\"control-ribbon\">\r\n        <div class=\"control-group\">\r\n            <label>\ud83d\udccc Inspection level<\/label>\r\n            <select id=\"levelSelect\">\r\n                <option value=\"S-1\">S-1 (special)<\/option>\r\n                <option value=\"S-2\">S-2 (special)<\/option>\r\n                <option value=\"S-3\">S-3 (special)<\/option>\r\n                <option value=\"S-4\">S-4 (special)<\/option>\r\n                <option value=\"I\">I (reduced)<\/option>\r\n                <option value=\"II\" selected>II (normal)<\/option>\r\n                <option value=\"III\">III (tightened)<\/option>\r\n            <\/select>\r\n        <\/div>\r\n        <div class=\"control-group\">\r\n            <label>\ud83d\udce6 Lot size (N)<\/label>\r\n            <input type=\"number\" id=\"lotSize\" min=\"2\" max=\"500000\" value=\"3500\" step=\"1\">\r\n        <\/div>\r\n        <div class=\"code-chip\">\r\n            sample code <span id=\"codeLetterDisplay\">M<\/span>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <!-- Tabs navigation -->\r\n    <div class=\"tab-section\">\r\n        <div class=\"tabs\">\r\n            <button class=\"tab-btn active\" id=\"tab1Btn\">\ud83d\udccb AQL chart (Ac\/Re)<\/button>\r\n            <button class=\"tab-btn\" id=\"tab2Btn\">\ud83d\udcc8 OC curves & risk<\/button>\r\n            <button class=\"tab-btn\" id=\"tab3Btn\">\ud83d\udd0d code letter master<\/button>\r\n        <\/div>\r\n\r\n        <!-- Tab 1 : main AQL table (similar to previous, but extended) -->\r\n        <div class=\"tab-content active\" id=\"tab1Content\">\r\n            <div class=\"table-wrapper\">\r\n                <table>\r\n                    <thead>\r\n                        <tr><th>AQL (%) \u2192<\/th><th>Sample size (n)<\/th><th>Accept \/ Reject<\/th><th>quality inference<\/th><\/tr>\r\n                    <\/thead>\r\n                    <tbody id=\"mainTableBody\">\r\n                        <!-- filled by js -->\r\n                    <\/tbody>\r\n                <\/table>\r\n            <\/div>\r\n            <p style=\"margin-top:1rem;font-size:0.85rem;color:#476b8f;\">\u2b07\ufe0f arrow means: use next lower code letter (larger sample).<\/p>\r\n        <\/div>\r\n\r\n        <!-- Tab 2 : OC curves + producer\/consumer risk -->\r\n        <div class=\"tab-content\" id=\"tab2Content\">\r\n            <div class=\"curves-container\">\r\n                <div class=\"oc-card\">\r\n                    <h3>\ud83d\udcca Operating characteristics<\/h3>\r\n                    <div id=\"ocStats\">loading ...<\/div>\r\n                    <table class=\"mini-table\" id=\"ocTable\">\r\n                        <tr><th>defect %<\/th><th>Pa (acceptance prob)<\/th><\/tr>\r\n                        <!-- dynamic rows -->\r\n                    <\/table>\r\n                <\/div>\r\n                <div class=\"oc-card\">\r\n                    <h3>\u2696\ufe0f AQL \/ RQL \/ risks<\/h3>\r\n                    <div id=\"riskDisplay\"><\/div>\r\n                    <table class=\"mini-table\" id=\"riskTable\">\r\n                        <tr><td>AQL (\u03b1 risk)<\/td><td id=\"aqlRiskVal\">1.0%<\/td><\/tr>\r\n                        <tr><td>LTPD (\u03b2 risk)<\/td><td id=\"ltpdVal\">\u2014<\/td><\/tr>\r\n                        <tr><td>Producer risk (\u03b1)<\/td><td id=\"producerRisk\">0.05<\/td><\/tr>\r\n                        <tr><td>Consumer risk (\u03b2)<\/td><td id=\"consumerRisk\">0.10<\/td><\/tr>\r\n                    <\/table>\r\n                <\/div>\r\n            <\/div>\r\n        <\/div>\r\n\r\n        <!-- Tab 3 : Code letter master table (inspection level \u2194 lot size) -->\r\n        <div class=\"tab-content\" id=\"tab3Content\">\r\n            <div class=\"table-wrapper\">\r\n                <table>\r\n                    <thead><tr><th>Lot size<\/th><th>S-1<\/th><th>S-2<\/th><th>S-3<\/th><th>S-4<\/th><th>I<\/th><th>II<\/th><th>III<\/th><\/tr><\/thead>\r\n                    <tbody id=\"codeMasterBody\">\r\n                        <!-- generated -->\r\n                    <\/tbody>\r\n                <\/table>\r\n            <\/div>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <div class=\"footnote\">\r\n        <div id=\"rangeDescription\">\u2699\ufe0f normal II \u00b7 lot 3500 \u2192 code M \u00b7 n=315<\/div>\r\n        <div><a class=\"reset-link\" id=\"resetDefaults\">\u21bb reset to normal\/3500<\/a> \u00b7 based on ANSI\/ASQ Z1.4<\/div>\r\n    <\/div>\r\n<\/div>\r\n\r\n<script>\r\n(function() {\r\n    \/\/ ---- constants (master table) ----\r\n    const AQL_VALS = [0.065, 0.10, 0.15, 0.25, 0.40, 0.65, 1.0, 1.5, 2.5, 4.0, 6.5];\r\n    const SAMPLE_SIZE = {\r\n        'A':2,'B':3,'C':5,'D':8,'E':13,'F':20,'G':32,'H':50,'I':80,'J':125,'K':200,'L':315,'M':500,\r\n        'N':800,'O':1250,'P':2000,'Q':3150,'R':5000\r\n    };\r\n    \/\/ Ac\/Re limits per code (11 columns). null = use next lower code (higher sample)\r\n    const AQL_LIMITS = {\r\n        'A': [null,null,null,null,null,null,null,null,null,[0,1],[0,1]],\r\n        'B': [null,null,null,null,null,null,null,null,[0,1],[0,1],[1,2]],\r\n        'C': [null,null,null,null,null,null,null,[0,1],[0,1],[1,2],[2,3]],\r\n        'D': [null,null,null,null,null,null,[0,1],[0,1],[1,2],[2,3],[3,4]],\r\n        'E': [null,null,null,null,null,[0,1],[0,1],[1,2],[2,3],[3,4],[5,6]],\r\n        'F': [null,null,null,null,[0,1],[0,1],[1,2],[2,3],[3,4],[5,6],[7,8]],\r\n        'G': [null,null,null,[0,1],[0,1],[1,2],[2,3],[3,4],[5,6],[7,8],[10,11]],\r\n        'H': [null,null,[0,1],[0,1],[1,2],[2,3],[3,4],[5,6],[7,8],[10,11],[14,15]],\r\n        'I': [null,[0,1],[0,1],[1,2],[2,3],[3,4],[5,6],[7,8],[10,11],[14,15],[21,22]],\r\n        'J': [[0,1],[0,1],[1,2],[2,3],[3,4],[5,6],[7,8],[10,11],[14,15],[21,22],[30,31]],\r\n        'K': [[0,1],[1,2],[2,3],[3,4],[5,6],[7,8],[10,11],[14,15],[21,22],[30,31],[44,45]],\r\n        'L': [[1,2],[2,3],[3,4],[5,6],[7,8],[10,11],[14,15],[21,22],[30,31],[44,45],null],\r\n        'M': [[2,3],[3,4],[5,6],[7,8],[10,11],[14,15],[21,22],[30,31],[44,45],null,null],\r\n        'N': [[3,4],[5,6],[7,8],[10,11],[14,15],[21,22],[30,31],[44,45],null,null,null],\r\n        'O': [[5,6],[7,8],[10,11],[14,15],[21,22],[30,31],[44,45],null,null,null,null],\r\n        'P': [[7,8],[10,11],[14,15],[21,22],[30,31],[44,45],null,null,null,null,null],\r\n        'Q': [[10,11],[14,15],[21,22],[30,31],[44,45],null,null,null,null,null,null],\r\n        'R': [[14,15],[21,22],[30,31],[44,45],null,null,null,null,null,null,null]\r\n    };\r\n\r\n    \/\/ code letter based on level & lot (table I)\r\n    function getCodeLetter(level, lotSize) {\r\n        const size = Number(lotSize);\r\n        const matrix = {\r\n            'S-1':[[2,8,'A'],[9,15,'A'],[16,25,'B'],[26,50,'B'],[51,90,'B'],[91,150,'C'],[151,280,'C'],[281,500,'C'],[501,1200,'D'],[1201,3200,'D'],[3201,10000,'D'],[10001,35000,'E'],[35001,150000,'E'],[150001,500000,'F']],\r\n            'S-2':[[2,8,'A'],[9,15,'A'],[16,25,'B'],[26,50,'C'],[51,90,'C'],[91,150,'D'],[151,280,'E'],[281,500,'E'],[501,1200,'F'],[1201,3200,'G'],[3201,10000,'H'],[10001,35000,'I'],[35001,150000,'J'],[150001,500000,'K']],\r\n            'S-3':[[2,8,'A'],[9,15,'B'],[16,25,'C'],[26,50,'D'],[51,90,'E'],[91,150,'F'],[151,280,'G'],[281,500,'H'],[501,1200,'I'],[1201,3200,'J'],[3201,10000,'K'],[10001,35000,'L'],[35001,150000,'M'],[150001,500000,'N']],\r\n            'S-4':[[2,8,'B'],[9,15,'C'],[16,25,'D'],[26,50,'E'],[51,90,'F'],[91,150,'G'],[151,280,'H'],[281,500,'I'],[501,1200,'J'],[1201,3200,'K'],[3201,10000,'L'],[10001,35000,'M'],[35001,150000,'N'],[150001,500000,'O']],\r\n            'I':  [[2,8,'B'],[9,15,'C'],[16,25,'D'],[26,50,'E'],[51,90,'F'],[91,150,'G'],[151,280,'H'],[281,500,'I'],[501,1200,'J'],[1201,3200,'K'],[3201,10000,'L'],[10001,35000,'M'],[35001,150000,'N'],[150001,500000,'O']],\r\n            'II': [[2,8,'A'],[9,15,'B'],[16,25,'C'],[26,50,'D'],[51,90,'E'],[91,150,'F'],[151,280,'G'],[281,500,'H'],[501,1200,'I'],[1201,3200,'J'],[3201,10000,'K'],[10001,35000,'L'],[35001,150000,'M'],[150001,500000,'N']],\r\n            'III':[[2,8,'B'],[9,15,'C'],[16,25,'D'],[26,50,'E'],[51,90,'F'],[91,150,'G'],[151,280,'H'],[281,500,'I'],[501,1200,'J'],[1201,3200,'K'],[3201,10000,'L'],[10001,35000,'M'],[35001,150000,'N'],[150001,500000,'O']]\r\n        };\r\n        const lev = matrix[level] || matrix['II'];\r\n        for (let [low, high, code] of lev) if (size>=low && size<=high) return code;\r\n        return size>500000 ? 'R' : 'A';\r\n    }\r\n\r\n    \/\/ ----- helper: binomial probability for OC (simplified) -----\r\n    function probAccept(n, Ac, p) {\r\n        if (Ac < 0) return 0;\r\n        let prob = 0;\r\n        let q = 1 - p;\r\n        \/\/ cumulative binomial using iterative product (simplified, sufficient for demo)\r\n        let comb = 1;\r\n        let pterm = Math.pow(q, n);\r\n        for (let k = 0; k <= Ac; k++) {\r\n            if (k > 0) {\r\n                comb = comb * (n - k + 1) \/ k;\r\n                pterm = pterm * (p \/ q);\r\n            }\r\n            prob += comb * pterm;\r\n            if (prob > 1) prob = 1;\r\n        }\r\n        return Math.min(prob, 1);\r\n    }\r\n\r\n    \/\/ ----- render tab1 (AQL table) -----\r\n    function renderMainTable(code) {\r\n        const tbody = document.getElementById('mainTableBody');\r\n        const n = SAMPLE_SIZE[code] || 0;\r\n        const limits = AQL_LIMITS[code] || [];\r\n        let html = '';\r\n        for (let i=0; i<AQL_VALS.length; i++) {\r\n            const aql = AQL_VALS[i];\r\n            const pair = limits[i];\r\n            let cell;\r\n            if (pair === null) {\r\n                const nextCode = getNextLowerCode(code);\r\n                if (nextCode) cell = `<span class=\"missing\">\u2193 use ${nextCode} (n=${SAMPLE_SIZE[nextCode]})<\/span>`;\r\n                else cell = `<span class=\"missing\">\u2014<\/span>`;\r\n            } else {\r\n                const [ac, rej] = pair;\r\n                cell = `<span class=\"ac-rej-badge\"><span class=\"ac\">Ac ${ac}<\/span><span class=\"divider\">|<\/span><span class=\"rej\">Re ${rej}<\/span><\/span>`;\r\n            }\r\n            let inference = '';\r\n            if (pair) {\r\n                const [ac,] = pair;\r\n                if (ac === 0) inference = '\ud83d\udd35 zero-defect plan';\r\n                else if (ac <= 2) inference = '\ud83d\udfe2 very tight';\r\n                else if (ac <= 5) inference = '\ud83d\udfe1 moderate';\r\n                else inference = '\ud83d\udfe0 loose';\r\n            } else inference = '\u26aa see arrow';\r\n            html += `<tr><td><span class=\"code-ref\">${aql}%<\/span><\/td><td><strong>${n}<\/strong><\/td><td>${cell}<\/td><td>${inference}<\/td><\/tr>`;\r\n        }\r\n        tbody.innerHTML = html;\r\n    }\r\n\r\n    function getNextLowerCode(code) {\r\n        const order = Object.keys(SAMPLE_SIZE);\r\n        let idx = order.indexOf(code);\r\n        return (idx>0 && idx<order.length) ? order[idx-1] : null;\r\n    }\r\n\r\n    \/\/ ----- tab2 : OC curves & risk (based on current code + first non\u2011null AQL pair) -----\r\n    function renderOCTab(code) {\r\n        const n = SAMPLE_SIZE[code] || 0;\r\n        const limits = AQL_LIMITS[code] || [];\r\n        \/\/ pick first non\u2011null Ac\/Re from medium AQL (e.g. index around 5 = 0.65%)\r\n        let ac = null, rej = null, aqlVal = null;\r\n        for (let i=0; i<limits.length; i++) {\r\n            if (limits[i] !== null) {\r\n                [ac, rej] = limits[i];\r\n                aqlVal = AQL_VALS[i];\r\n                break;\r\n            }\r\n        }\r\n        const ocTbody = document.getElementById('ocTable');\r\n        const riskDiv = document.getElementById('riskDisplay');\r\n        if (ac === null || n === 0) {\r\n            ocTbody.innerHTML = '<tr><td colspan=\"2\">no valid Ac\/Re for this code<\/td><\/tr>';\r\n            riskDiv.innerText = 'incomplete data';\r\n            return;\r\n        }\r\n\r\n        \/\/ compute OC for p = 0.1, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0 %\r\n        const pVals = [0.1,0.5,1.0,1.5,2.0,2.5,3.0,4.0,5.0,6.0,8.0];\r\n        let rows = '';\r\n        pVals.forEach(p => {\r\n            let pa = probAccept(n, ac, p\/100);\r\n            rows += `<tr><td>${p}%<\/td><td>${(pa*100).toFixed(2)}%<\/td><\/tr>`;\r\n        });\r\n        ocTbody.innerHTML = rows;\r\n\r\n        \/\/ risk: producer risk at AQL (\u03b1 \u2248 1 - Pa at AQL)\r\n        let paAQL = probAccept(n, ac, aqlVal\/100);\r\n        let producerRisk = (1 - paAQL).toFixed(4);\r\n        \/\/ LTPD often taken at 10% consumer risk (\u03b2 = 0.1) => find p such that Pa = 0.10\r\n        let ltpdEst = '~' + (aqlVal * 3.5).toFixed(2) + '%'; \/\/ rough heuristic\r\n        document.getElementById('aqlRiskVal').innerText = aqlVal + '%';\r\n        document.getElementById('ltpdVal').innerText = ltpdEst;\r\n        document.getElementById('producerRisk').innerText = producerRisk;\r\n        document.getElementById('consumerRisk').innerText = '0.10 (assumed)';\r\n        riskDiv.innerHTML = `AQL = ${aqlVal}%  (Ac=${ac}, Re=${rej})  n=${n}`;\r\n    }\r\n\r\n    \/\/ ----- tab3 : code master table (all levels) -----\r\n    function renderMasterCodeTable() {\r\n        const lotRanges = [\r\n            [2,8], [9,15], [16,25], [26,50], [51,90], [91,150], [151,280], [281,500],\r\n            [501,1200], [1201,3200], [3201,10000], [10001,35000], [35001,150000], [150001,500000]\r\n        ];\r\n        const levels = ['S-1','S-2','S-3','S-4','I','II','III'];\r\n        let html = '';\r\n        for (let [low, high] of lotRanges) {\r\n            let row = `<tr><td>${low} \u2013 ${high}<\/td>`;\r\n            for (let lev of levels) {\r\n                let code = getCodeLetter(lev, (low+high)\/2); \/\/ any inside range works\r\n                row += `<td><strong>${code}<\/strong><\/td>`;\r\n            }\r\n            row += '<\/tr>';\r\n            html += row;\r\n        }\r\n        document.getElementById('codeMasterBody').innerHTML = html;\r\n    }\r\n\r\n    \/\/ ----- main update across all tabs -----\r\n    function updateAll() {\r\n        const level = document.getElementById('levelSelect').value;\r\n        const lotSize = document.getElementById('lotSize').value;\r\n        const code = getCodeLetter(level, lotSize);\r\n        document.getElementById('codeLetterDisplay').innerText = code;\r\n        document.getElementById('rangeDescription').innerHTML = `\u2699\ufe0f ${level} \u00b7 lot ${lotSize} \u2192 code ${code} \u00b7 n=${SAMPLE_SIZE[code] || '?'}`;\r\n\r\n        renderMainTable(code);\r\n        renderOCTab(code);\r\n        \/\/ master table independent, already built once\r\n    }\r\n\r\n    \/\/ tab switching\r\n    function setupTabs() {\r\n        const tab1Btn = document.getElementById('tab1Btn');\r\n        const tab2Btn = document.getElementById('tab2Btn');\r\n        const tab3Btn = document.getElementById('tab3Btn');\r\n        const tab1 = document.getElementById('tab1Content');\r\n        const tab2 = document.getElementById('tab2Content');\r\n        const tab3 = document.getElementById('tab3Content');\r\n\r\n        function setActive(activeId) {\r\n            [tab1,tab2,tab3].forEach(t => t.classList.remove('active'));\r\n            [tab1Btn,tab2Btn,tab3Btn].forEach(b => b.classList.remove('active'));\r\n            if (activeId === 1) { tab1.classList.add('active'); tab1Btn.classList.add('active'); }\r\n            else if (activeId === 2) { tab2.classList.add('active'); tab2Btn.classList.add('active'); }\r\n            else { tab3.classList.add('active'); tab3Btn.classList.add('active'); }\r\n        }\r\n        tab1Btn.addEventListener('click', (e) => { e.preventDefault(); setActive(1); });\r\n        tab2Btn.addEventListener('click', (e) => { e.preventDefault(); setActive(2); renderOCTab(getCodeLetter(document.getElementById('levelSelect').value, document.getElementById('lotSize').value)); });\r\n        tab3Btn.addEventListener('click', (e) => { e.preventDefault(); setActive(3); });\r\n    }\r\n\r\n    \/\/ listeners\r\n    document.getElementById('levelSelect').addEventListener('change', updateAll);\r\n    document.getElementById('lotSize').addEventListener('input', function() {\r\n        let v = parseInt(this.value,10); if (isNaN(v) || v<2) v=2; if (v>999999) v=999999; this.value=v; updateAll();\r\n    });\r\n    document.getElementById('resetDefaults').addEventListener('click', (e) => {\r\n        e.preventDefault();\r\n        document.getElementById('levelSelect').value = 'II';\r\n        document.getElementById('lotSize').value = '3500';\r\n        updateAll();\r\n    });\r\n\r\n    \/\/ initialise\r\n    renderMasterCodeTable(); \/\/ static\r\n    updateAll();\r\n    setupTabs();\r\n})();\r\n<\/script>\r\n<\/body>\r\n<\/html>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>AQL complete suite \u00b7 sampling plans, OC curves, limits (ANSI\/ASQ Z1.4) \u2699\ufe0f AQL complete suite ANSI\/ASQ Z1.4 \/ ISO 2859-1 Single sampling (normal) \u00b7 master table II-A \u00b7 OC curves &#038; sampling limits \ud83d\udccc Inspection level S-1 (special)S-2 (special)S-3 (special)S-4 (special)I (reduced)II (normal)III (tightened) \ud83d\udce6 Lot size (N) sample code M \ud83d\udccb AQL chart (Ac\/Re)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-14969","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Aql Sample Size Calculator - secured inspection services<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/securedinspectionservices.com\/?page_id=14969\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Aql Sample Size Calculator - secured inspection services\" \/>\n<meta property=\"og:description\" content=\"AQL complete suite \u00b7 sampling plans, OC curves, limits (ANSI\/ASQ Z1.4) \u2699\ufe0f AQL complete suite ANSI\/ASQ Z1.4 \/ ISO 2859-1 Single sampling (normal) \u00b7 master table II-A \u00b7 OC curves &#038; sampling limits \ud83d\udccc Inspection level S-1 (special)S-2 (special)S-3 (special)S-4 (special)I (reduced)II (normal)III (tightened) \ud83d\udce6 Lot size (N) sample code M \ud83d\udccb AQL chart (Ac\/Re)...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/securedinspectionservices.com\/?page_id=14969\" \/>\n<meta property=\"og:site_name\" content=\"secured inspection services\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-17T19:23:32+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/?page_id=14969\",\"url\":\"https:\\\/\\\/securedinspectionservices.com\\\/?page_id=14969\",\"name\":\"Aql Sample Size Calculator - secured inspection services\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#website\"},\"datePublished\":\"2026-02-17T14:48:08+00:00\",\"dateModified\":\"2026-02-17T19:23:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/?page_id=14969#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/securedinspectionservices.com\\\/?page_id=14969\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/?page_id=14969#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/securedinspectionservices.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Aql Sample Size Calculator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#website\",\"url\":\"https:\\\/\\\/securedinspectionservices.com\\\/\",\"name\":\"Secured Inspection Services\",\"description\":\"Your Quality control partners\",\"publisher\":{\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/securedinspectionservices.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#organization\",\"name\":\"Secured Inspection Services\",\"url\":\"https:\\\/\\\/securedinspectionservices.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/securedinspectionservices.com\\\/wp-content\\\/uploads\\\/2024\\\/08\\\/d.jpg\",\"contentUrl\":\"https:\\\/\\\/securedinspectionservices.com\\\/wp-content\\\/uploads\\\/2024\\\/08\\\/d.jpg\",\"width\":1065,\"height\":230,\"caption\":\"Secured Inspection Services\"},\"image\":{\"@id\":\"https:\\\/\\\/securedinspectionservices.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Aql Sample Size Calculator - secured inspection services","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/securedinspectionservices.com\/?page_id=14969","og_locale":"en_US","og_type":"article","og_title":"Aql Sample Size Calculator - secured inspection services","og_description":"AQL complete suite \u00b7 sampling plans, OC curves, limits (ANSI\/ASQ Z1.4) \u2699\ufe0f AQL complete suite ANSI\/ASQ Z1.4 \/ ISO 2859-1 Single sampling (normal) \u00b7 master table II-A \u00b7 OC curves &#038; sampling limits \ud83d\udccc Inspection level S-1 (special)S-2 (special)S-3 (special)S-4 (special)I (reduced)II (normal)III (tightened) \ud83d\udce6 Lot size (N) sample code M \ud83d\udccb AQL chart (Ac\/Re)...","og_url":"https:\/\/securedinspectionservices.com\/?page_id=14969","og_site_name":"secured inspection services","article_modified_time":"2026-02-17T19:23:32+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/securedinspectionservices.com\/?page_id=14969","url":"https:\/\/securedinspectionservices.com\/?page_id=14969","name":"Aql Sample Size Calculator - secured inspection services","isPartOf":{"@id":"https:\/\/securedinspectionservices.com\/#website"},"datePublished":"2026-02-17T14:48:08+00:00","dateModified":"2026-02-17T19:23:32+00:00","breadcrumb":{"@id":"https:\/\/securedinspectionservices.com\/?page_id=14969#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/securedinspectionservices.com\/?page_id=14969"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/securedinspectionservices.com\/?page_id=14969#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/securedinspectionservices.com\/"},{"@type":"ListItem","position":2,"name":"Aql Sample Size Calculator"}]},{"@type":"WebSite","@id":"https:\/\/securedinspectionservices.com\/#website","url":"https:\/\/securedinspectionservices.com\/","name":"Secured Inspection Services","description":"Your Quality control partners","publisher":{"@id":"https:\/\/securedinspectionservices.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/securedinspectionservices.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/securedinspectionservices.com\/#organization","name":"Secured Inspection Services","url":"https:\/\/securedinspectionservices.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/securedinspectionservices.com\/#\/schema\/logo\/image\/","url":"https:\/\/securedinspectionservices.com\/wp-content\/uploads\/2024\/08\/d.jpg","contentUrl":"https:\/\/securedinspectionservices.com\/wp-content\/uploads\/2024\/08\/d.jpg","width":1065,"height":230,"caption":"Secured Inspection Services"},"image":{"@id":"https:\/\/securedinspectionservices.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/pages\/14969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14969"}],"version-history":[{"count":16,"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/pages\/14969\/revisions"}],"predecessor-version":[{"id":14987,"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=\/wp\/v2\/pages\/14969\/revisions\/14987"}],"wp:attachment":[{"href":"https:\/\/securedinspectionservices.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}