<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.24.1.1.u2</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>136</ContextCount>
  <ElementCount>237</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>29</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>5</UnitCount>
  <MyReports>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>0000001 - Document - COVER PAGE</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/COVERPAGE</Role>
      <ShortName>COVER PAGE</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>0000002 - Statement - CONSOLIDATED BALANCE SHEETS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDBALANCESHEETS</Role>
      <ShortName>CONSOLIDATED BALANCE SHEETS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>0000003 - Statement - CONSOLIDATED BALANCE SHEETS (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDBALANCESHEETSParenthetical</Role>
      <ShortName>CONSOLIDATED BALANCE SHEETS (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>0000004 - Statement - CONSOLIDATED STATEMENTS OF OPERATIONS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDSTATEMENTSOFOPERATIONS</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF OPERATIONS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>0000005 - Statement - CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (LOSS)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDSTATEMENTSOFCOMPREHENSIVEINCOMELOSS</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (LOSS)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>0000006 - Statement - CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDSTATEMENTSOFCOMPREHENSIVEINCOMEParenthetical</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>0000007 - Statement - CONSOLIDATED STATEMENTS OF CASH FLOWS</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDSTATEMENTSOFCASHFLOWS</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF CASH FLOWS</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>0000008 - Statement - CONSOLIDATED STATEMENTS OF SHAREHOLDER'S EQUITY</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CONSOLIDATEDSTATEMENTSOFSHAREHOLDERSEQUITY</Role>
      <ShortName>CONSOLIDATED STATEMENTS OF SHAREHOLDER'S EQUITY</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>0000009 - Disclosure - Basis of Presentation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/BasisofPresentation</Role>
      <ShortName>Basis of Presentation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>0000010 - Disclosure - Significant Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SignificantAccountingPolicies</Role>
      <ShortName>Significant Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>0000011 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/Inventories</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>0000012 - Disclosure - Long-Term Debt</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LongTermDebt</Role>
      <ShortName>Long-Term Debt</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>0000013 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/IncomeTaxes</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>0000014 - Disclosure - Earnings Per Share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/EarningsPerShare</Role>
      <ShortName>Earnings Per Share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>0000015 - Disclosure - Share-based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SharebasedCompensation</Role>
      <ShortName>Share-based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>0000016 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CommitmentsandContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>0000017 - Disclosure - Derivative Financial Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/DerivativeFinancialInstruments</Role>
      <ShortName>Derivative Financial Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>0000018 - Disclosure - Revenue</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/Revenue</Role>
      <ShortName>Revenue</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>0000019 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/Leases</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>0000020 - Disclosure - Subsequent Events</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SubsequentEvents</Role>
      <ShortName>Subsequent Events</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>995410 - Disclosure - Pay vs Performance Disclosure</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/PvpDisclosure</Role>
      <ShortName>Pay vs Performance Disclosure</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>995445 - Disclosure - Insider Trading Arrangements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/InsiderTradingArrangements</Role>
      <ShortName>Insider Trading Arrangements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>9954471 - Disclosure - Significant Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SignificantAccountingPoliciesPolicies</Role>
      <ShortName>Significant Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/SignificantAccountingPolicies</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>9954472 - Disclosure - Long-Term Debt (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LongTermDebtTables</Role>
      <ShortName>Long-Term Debt (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/LongTermDebt</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>9954473 - Disclosure - Earnings Per Share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/EarningsPerShareTables</Role>
      <ShortName>Earnings Per Share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/EarningsPerShare</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>9954474 - Disclosure - Share-based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SharebasedCompensationTables</Role>
      <ShortName>Share-based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/SharebasedCompensation</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>9954475 - Disclosure - Derivative Financial Instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/DerivativeFinancialInstrumentsTables</Role>
      <ShortName>Derivative Financial Instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/DerivativeFinancialInstruments</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>9954476 - Disclosure - Revenue (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/RevenueTables</Role>
      <ShortName>Revenue (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/Revenue</ParentRole>
      <Position>28</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>9954477 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/Leases</ParentRole>
      <Position>29</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>9954478 - Disclosure - Basis of Presentation (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/BasisofPresentationDetails</Role>
      <ShortName>Basis of Presentation (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.keytronic.com/role/BasisofPresentation</ParentRole>
      <Position>30</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>9954479 - Disclosure - Inventories - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/InventoriesNarrativeDetails</Role>
      <ShortName>Inventories - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>9954480 - Disclosure - Long-Term Debt - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LongTermDebtNarrativeDetails</Role>
      <ShortName>Long-Term Debt - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>9954481 - Disclosure - Long-Term Debt - Schedule of Maturities of Long-term Debt (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LongTermDebtScheduleofMaturitiesofLongtermDebtDetails</Role>
      <ShortName>Long-Term Debt - Schedule of Maturities of Long-term Debt (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>9954482 - Disclosure - Income Taxes - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/IncomeTaxesNarrativeDetails</Role>
      <ShortName>Income Taxes - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>9954483 - Disclosure - Earnings Per Share - Schedule of Antidilutive Securities and Outstanding Equity Awards (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/EarningsPerShareScheduleofAntidilutiveSecuritiesandOutstandingEquityAwardsDetails</Role>
      <ShortName>Earnings Per Share - Schedule of Antidilutive Securities and Outstanding Equity Awards (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>9954484 - Disclosure - Share-based Compensation - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SharebasedCompensationNarrativeDetails</Role>
      <ShortName>Share-based Compensation - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>9954485 - Disclosure - Share-based Compensation - Schedule of Share-based Compensation for the Awards Granted (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/SharebasedCompensationScheduleofSharebasedCompensationfortheAwardsGrantedDetails</Role>
      <ShortName>Share-based Compensation - Schedule of Share-based Compensation for the Awards Granted (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>9954486 - Disclosure - Commitments and Contingencies - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/CommitmentsandContingenciesNarrativeDetails</Role>
      <ShortName>Commitments and Contingencies - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>9954487 - Disclosure - Derivative Financial Instruments - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/DerivativeFinancialInstrumentsNarrativeDetails</Role>
      <ShortName>Derivative Financial Instruments - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>9954488 - Disclosure - Derivative Financial Instruments - Schedule of Gain (Loss) of Derivative Instruments in Statement of Operations (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/DerivativeFinancialInstrumentsScheduleofGainLossofDerivativeInstrumentsinStatementofOperationsDetails</Role>
      <ShortName>Derivative Financial Instruments - Schedule of Gain (Loss) of Derivative Instruments in Statement of Operations (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>9954489 - Disclosure - Revenue - Schedule of Contract Assets (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/RevenueScheduleofContractAssetsDetails</Role>
      <ShortName>Revenue - Schedule of Contract Assets (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>9954490 - Disclosure - Revenue - Schedule of Disaggregation of Revenue (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/RevenueScheduleofDisaggregationofRevenueDetails</Role>
      <ShortName>Revenue - Schedule of Disaggregation of Revenue (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>9954491 - Disclosure - Leases - Narrative (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LeasesNarrativeDetails</Role>
      <ShortName>Leases - Narrative (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>9954492 - Disclosure - Leases - Schedule of Lease Cost (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LeasesScheduleofLeaseCostDetails</Role>
      <ShortName>Leases - Schedule of Lease Cost (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>9954493 - Disclosure - Leases - Schedule of Lease Assets and Liabilities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LeasesScheduleofLeaseAssetsandLiabilitiesDetails</Role>
      <ShortName>Leases - Schedule of Lease Assets and Liabilities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="ktcc-20240330.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>9954494 - Disclosure - Leases - Schedule of Maturities of Future Lease Payment (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.keytronic.com/role/LeasesScheduleofMaturitiesofFutureLeasePaymentDetails</Role>
      <ShortName>Leases - Schedule of Maturities of Future Lease Payment (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" isDefinitelyFs="true" isUsgaap="true" original="ktcc-20240330.htm">ktcc-20240330.htm</File>
    <File>ktcc-20240330.xsd</File>
    <File>ktcc-20240330_cal.xml</File>
    <File>ktcc-20240330_def.xml</File>
    <File>ktcc-20240330_lab.xml</File>
    <File>ktcc-20240330_pre.xml</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="551">http://fasb.org/us-gaap/2023</BaseTaxonomy>
    <BaseTaxonomy items="29">http://xbrl.sec.gov/dei/2023</BaseTaxonomy>
    <BaseTaxonomy items="4">http://xbrl.sec.gov/ecd/2023</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
