<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2026"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="jbss-20260819.xsd" xlink:type="simple"/>
    <context id="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000880117</identifier>
        </entity>
        <period>
            <startDate>2026-08-19</startDate>
            <endDate>2026-08-19</endDate>
        </period>
    </context>
    <dei:AmendmentFlag
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_effa9f22-e2cd-4eba-b189-5fbf573d335e">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_f873908b-b7a3-4aee-80b0-e19d3029538b">0000880117</dei:EntityCentralIndexKey>
    <dei:EntityRegistrantName
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_83f75392-530a-4511-a0f0-99816f616606">SANFILIPPO JOHN B &amp; SON INC</dei:EntityRegistrantName>
    <dei:DocumentType
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_807b0819-d954-4a83-b43a-7b018b6a161d">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_7c188af2-16c8-47bc-b060-a0bbf0b53cf4">2026-08-19</dei:DocumentPeriodEndDate>
    <dei:EntityIncorporationStateCountryCode
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_3284dc55-412b-4722-ac49-e9415fc13134">DE</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_d62b653c-e280-448f-9cb8-351ce6489183">0-19681</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_4b4b6a72-4a6b-496e-bed1-c9e8f7505e7e">36-2419677</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_52c25ef9-366c-4518-bc65-1524de231883">1703 N. RANDALL ROAD</dei:EntityAddressAddressLine1>
    <dei:EntityAddressCityOrTown
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_d5a5f2a4-e7fe-45b3-9ac4-e503955382c0">Elgin</dei:EntityAddressCityOrTown>
    <dei:EntityAddressStateOrProvince
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_a947f5ab-6de1-4e17-a992-4745275441a1">IL</dei:EntityAddressStateOrProvince>
    <dei:EntityAddressPostalZipCode
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_0e83e921-7a16-4f9a-a995-c85fc6f85766">60123-7820</dei:EntityAddressPostalZipCode>
    <dei:CityAreaCode
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_65184ce5-b4a9-4091-843b-d1e750b8ad0f">(847)</dei:CityAreaCode>
    <dei:LocalPhoneNumber
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_85b7bb9d-b4ba-4ee9-a214-1cf3a2009e79">289-1800</dei:LocalPhoneNumber>
    <dei:WrittenCommunications
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_7758f708-7dd5-40a2-a2af-6b536328a5bb">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_d8ef2f0d-a95c-46d1-8038-7f62241c92fa">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_df0f7e12-f3b6-41bd-9482-0333e9b880ec">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_d8f5bcee-3c12-4f51-9b3d-8ae7d7b7e1ea">false</dei:PreCommencementIssuerTenderOffer>
    <dei:Security12bTitle
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_8fdcb09f-d6d7-40a7-9e6c-e9d0168de5d1">Common Stock, $.01 par value per share</dei:Security12bTitle>
    <dei:TradingSymbol
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_0e0aa2ce-e79f-454e-88a9-1d534ff30214">JBSS</dei:TradingSymbol>
    <dei:SecurityExchangeName
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_2f546766-4d0b-4a7e-af90-49d71b1001b1">NASDAQ</dei:SecurityExchangeName>
    <dei:EntityEmergingGrowthCompany
      contextRef="C_dd3fae1a-4933-40fe-88b3-d20fe33ee9dd"
      id="F_ac2aef59-c254-4d9d-a2e6-391a7ee27d46">false</dei:EntityEmergingGrowthCompany>
</xbrl>
