<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2025"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="banf-20260723.xsd" xlink:type="simple"/>
    <context id="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000760498</identifier>
        </entity>
        <period>
            <startDate>2026-07-23</startDate>
            <endDate>2026-07-23</endDate>
        </period>
    </context>
    <dei:AmendmentFlag
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_6ad0dea5-3875-48f8-8210-eccac35911a0">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_c450e192-7588-4282-8c6a-da960d88c877">0000760498</dei:EntityCentralIndexKey>
    <dei:DocumentType
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_92cdca36-9e8f-4eda-90b2-8c678d4c85b2">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_0ea0dca1-3e2a-4fd3-bcd7-91001a44cc4a">2026-07-23</dei:DocumentPeriodEndDate>
    <dei:EntityRegistrantName
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_9376b8bf-5b34-4c0b-ae81-5233cf208825">BancFirst Corporation</dei:EntityRegistrantName>
    <dei:EntityIncorporationStateCountryCode
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_cbe7641b-766e-40f6-8b79-5ba851c48b5a">OK</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_1a132928-0eb0-43b3-942e-0b3500958ef9">0-14384</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_7ebc096d-7cb0-4584-9d42-885d4a02555f">73-1221379</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_72bb4058-a97e-4e26-b541-272ce75ac7e5">100 N. Broadway Ave.</dei:EntityAddressAddressLine1>
    <dei:EntityAddressCityOrTown
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_10254517-d91a-4603-bbd5-40d177df6b20">Oklahoma City</dei:EntityAddressCityOrTown>
    <dei:EntityAddressStateOrProvince
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_0c614095-e11f-4df6-bab8-773004ba9c36">OK</dei:EntityAddressStateOrProvince>
    <dei:EntityAddressPostalZipCode
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_7ca73172-656c-4364-aa97-40d9cfa62f76">73102-8405</dei:EntityAddressPostalZipCode>
    <dei:CityAreaCode
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_0fd20b22-0344-4a16-9c95-10bc3bf2e8a0">405</dei:CityAreaCode>
    <dei:LocalPhoneNumber
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_5e628a9b-237d-494c-938e-3e330af0f29a">270-1086</dei:LocalPhoneNumber>
    <dei:EntityInformationFormerLegalOrRegisteredName
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_9a51064c-9f53-43cd-8e8b-2c274e8bbf1e">Not Applicable</dei:EntityInformationFormerLegalOrRegisteredName>
    <dei:WrittenCommunications
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_d4d703b8-3bae-451e-aba8-26630420706e">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_8f4c3be1-9c75-4943-a740-1c2950719024">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_12622449-04b6-4ea2-b6fc-5b7452e0641c">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_0f4a2cb1-cd82-4363-b214-b4f0527f5811">false</dei:PreCommencementIssuerTenderOffer>
    <dei:Security12bTitle
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_22aff5a4-1853-4eb8-bb39-be595eae39a2">Common Stock, $1.00 Par Value Per Share</dei:Security12bTitle>
    <dei:TradingSymbol
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_ff5dfb5f-4707-4961-ab24-aa961674034a">BANF</dei:TradingSymbol>
    <dei:SecurityExchangeName
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_1559e479-7cb5-48e9-bd00-4a22c5c79b78">NASDAQ</dei:SecurityExchangeName>
    <dei:EntityEmergingGrowthCompany
      contextRef="C_3b1a0a43-0d98-49c0-bc0c-2ecd447ad635"
      id="F_dc870eba-2332-40a5-9e68-795278dda96b">false</dei:EntityEmergingGrowthCompany>
</xbrl>
