<?xml version="1.0" encoding="utf-8"?>
<FilingSummary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Version>2.4.0.6</Version>
  <ProcessingTime />
  <ReportFormat>Html</ReportFormat>
  <ContextCount>8</ContextCount>
  <ElementCount>125</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>false</FootnotesReported>
  <SegmentCount>0</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>3</UnitCount>
  <MyReports>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>00 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/DocumentAndEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
    </Report>
    <Report>
      <IsDefault>true</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>01 - Statement - Condensed Consolidated Balance Sheets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/BalanceSheets</Role>
      <ShortName>Condensed Consolidated Balance Sheets</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>011 - Statement - Condensed Consolidated Balance Sheets (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/BalanceSheetsParenthetical</Role>
      <ShortName>Condensed Consolidated Balance Sheets (Parenthetical)</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>02 - Statement - Condensed Consolidated Statements of Income (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/StatementsOfIncome</Role>
      <ShortName>Condensed Consolidated Statements of Income (Unaudited)</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>03 - Statement - Condensed Consolidated Statements of Other Comprehensive Income (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/StatementsOfComprehensiveIncome</Role>
      <ShortName>Condensed Consolidated Statements of Other Comprehensive Income (Unaudited)</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>04 - Statement - Condensed Consolidated Statements of Cash Flows (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/StatementsOfCashFlows</Role>
      <ShortName>Condensed Consolidated Statements of Cash Flows (Unaudited)</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>06001 - Disclosure - Basis of Presentation.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/BasisOfPresentation</Role>
      <ShortName>Basis of Presentation.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>06002 - Disclosure - Recent Accounting Standards.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/RecentAccountingStandards</Role>
      <ShortName>Recent Accounting Standards.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>06003 - Disclosure - Earnings Per Share.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/EarningsPerShare</Role>
      <ShortName>Earnings Per Share.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>06004 - Disclosure - Inventories.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/Inventories</Role>
      <ShortName>Inventories.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>06005 - Disclosure - Property, Plant and Equipment.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/PropertyPlantAndEquipment</Role>
      <ShortName>Property, Plant and Equipment.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>06006 - Disclosure - Stock-Based Compensation.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/StockBasedCompensation</Role>
      <ShortName>Stock-Based Compensation.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>06007 - Disclosure - Intangible Assets.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/IntangibleAssets</Role>
      <ShortName>Intangible Assets.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>06008 - Disclosure - Dividends.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/Dividends</Role>
      <ShortName>Dividends.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>06009 - Disclosure - Segment Information.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/SegmentInformation</Role>
      <ShortName>Segment Information.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>06010 - Disclosure - Long-Term Obligations.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/LongTermObligations</Role>
      <ShortName>Long-Term Obligations.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>06011 - Disclosure - Income Taxes.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/IncomeTaxes</Role>
      <ShortName>Income Taxes.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>06012 - Disclosure - Discontinued Operations.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/DiscontinuedOperations</Role>
      <ShortName>Discontinued Operations.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>06013 - Disclosure - Litigation and Other Contingencies.</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://kmgchemicals.com/role/LitigationAndOtherContingencies</Role>
      <ShortName>Litigation and Other Contingencies.</ShortName>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <Logs>
    <Log type="Info">Process Flow-Through: 01 - Statement - Condensed Consolidated Balance Sheets</Log>
    <Log type="Info">	Process Flow-Through: Removing column 'Oct. 31, 2010'</Log>
    <Log type="Info">	Process Flow-Through: Removing column 'Jul. 31, 2010'</Log>
    <Log type="Info">Process Flow-Through: 011 - Statement - Condensed Consolidated Balance Sheets (Parenthetical)</Log>
    <Log type="Info">Process Flow-Through: 02 - Statement - Condensed Consolidated Statements of Income (Unaudited)</Log>
    <Log type="Info">Process Flow-Through: 03 - Statement - Condensed Consolidated Statements of Other Comprehensive Income (Unaudited)</Log>
    <Log type="Info">Process Flow-Through: 04 - Statement - Condensed Consolidated Statements of Cash Flows (Unaudited)</Log>
  </Logs>
  <InputFiles>
    <File>kmgb-20111031.xml</File>
    <File>kmgb-20111031.xsd</File>
    <File>kmgb-20111031_cal.xml</File>
    <File>kmgb-20111031_lab.xml</File>
    <File>kmgb-20111031_pre.xml</File>
  </InputFiles>
  <SupplementalFiles />
  <BaseTaxonomies />
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
