<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2023"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="mpb-20241104.xsd" xlink:type="simple"/>
    <context id="duration_2024-11-04_to_2024-11-04">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000879635</identifier>
        </entity>
        <period>
            <startDate>2024-11-04</startDate>
            <endDate>2024-11-04</endDate>
        </period>
    </context>
    <dei:EntityRegistrantName
      contextRef="duration_2024-11-04_to_2024-11-04"
      id="Hidden_dei_EntityRegistrantName">MID PENN BANCORP INC</dei:EntityRegistrantName>
    <dei:AmendmentFlag contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-284">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey
      contextRef="duration_2024-11-04_to_2024-11-04"
      id="Hidden_dei_EntityCentralIndexKey">0000879635</dei:EntityCentralIndexKey>
    <dei:DocumentType contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-295">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-296">2024-11-04</dei:DocumentPeriodEndDate>
    <dei:EntityIncorporationStateCountryCode contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-297">PA</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-298">1-13677</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-299">25-1666413</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1 contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-300">2407 Park Drive</dei:EntityAddressAddressLine1>
    <dei:EntityAddressCityOrTown contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-301">Harrisburg</dei:EntityAddressCityOrTown>
    <dei:EntityAddressStateOrProvince contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-302">PA</dei:EntityAddressStateOrProvince>
    <dei:CityAreaCode contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-303">1.866</dei:CityAreaCode>
    <dei:LocalPhoneNumber contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-304">642.7736</dei:LocalPhoneNumber>
    <dei:EntityAddressPostalZipCode contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-305">17110</dei:EntityAddressPostalZipCode>
    <dei:Security12bTitle contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-306">Common Stock, $1.00 par value per share</dei:Security12bTitle>
    <dei:TradingSymbol contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-307">MPB</dei:TradingSymbol>
    <dei:SecurityExchangeName contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-308">NASDAQ</dei:SecurityExchangeName>
    <dei:WrittenCommunications contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-309">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-310">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-311">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-312">false</dei:PreCommencementIssuerTenderOffer>
    <dei:EntityEmergingGrowthCompany contextRef="duration_2024-11-04_to_2024-11-04" id="ixv-313">false</dei:EntityEmergingGrowthCompany>
</xbrl>
