<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.25.1</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>1550</ContextCount>
  <ElementCount>853</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>385</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>11</UnitCount>
  <MyReports>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>0000 - Document - Cover Page</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CoverPage</Role>
      <ShortName>Cover Page</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>0010 - Statement - Consolidated statements of financial position</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Consolidatedstatementsoffinancialposition</Role>
      <ShortName>Consolidated statements of financial position</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>0020 - Statement - Consolidated statements of income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Consolidatedstatementsofincome</Role>
      <ShortName>Consolidated statements of income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>0030 - Statement - Consolidated statements of comprehensive income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Consolidatedstatementsofcomprehensiveincome</Role>
      <ShortName>Consolidated statements of comprehensive income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>0040 - Statement - Consolidated statements of changes in equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Consolidatedstatementsofchangesinequity</Role>
      <ShortName>Consolidated statements of changes in equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>0041 - Statement - Consolidated statements of changes in equity (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ConsolidatedstatementsofchangesinequityParenthetical</Role>
      <ShortName>Consolidated statements of changes in equity (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>0050 - Statement - Consolidated statements of cash flows - indirect method</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Consolidatedstatementsofcashflowsindirectmethod</Role>
      <ShortName>Consolidated statements of cash flows - indirect method</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>1010 - Disclosure - Operations</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Operations</Role>
      <ShortName>Operations</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>1020 - Disclosure - Basis of preparation and presentation of consolidated financial statements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Basisofpreparationandpresentationofconsolidatedfinancialstatements</Role>
      <ShortName>Basis of preparation and presentation of consolidated financial statements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>1025 - Disclosure - New accounting policies and changes in accounting policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Newaccountingpoliciesandchangesinaccountingpolicies</Role>
      <ShortName>New accounting policies and changes in accounting policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>1040 - Disclosure - Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Cashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassets</Role>
      <ShortName>Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>1050 - Disclosure - Trade receivables, reseller financing and other receivables</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Tradereceivablesresellerfinancingandotherreceivables</Role>
      <ShortName>Trade receivables, reseller financing and other receivables</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>1060 - Disclosure - Inventories</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Inventories</Role>
      <ShortName>Inventories</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>1070 - Disclosure - Recoverable taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Recoverabletaxes</Role>
      <ShortName>Recoverable taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>1080 - Disclosure - Related Parties</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedParties</Role>
      <ShortName>Related Parties</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>1090 - Disclosure - Income and Social Contribution Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxes</Role>
      <ShortName>Income and Social Contribution Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>1110 - Disclosure - Contractual assets with customers - exclusivity rights</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Contractualassetswithcustomersexclusivityrights</Role>
      <ShortName>Contractual assets with customers - exclusivity rights</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>1120 - Disclosure - Investments in subsidiaries, joint ventures and associates</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Investmentsinsubsidiariesjointventuresandassociates</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>1130 - Disclosure - Right-of-use assets and leases payable</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Rightofuseassetsandleasespayable</Role>
      <ShortName>Right-of-use assets and leases payable</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>1140 - Disclosure - Property, plant, and equipment</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Propertyplantandequipment</Role>
      <ShortName>Property, plant, and equipment</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>1150 - Disclosure - Intangible assets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Intangibleassets</Role>
      <ShortName>Intangible assets</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>21</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>1160 - Disclosure - Loans, financing, debentures and derivative financial instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Loansfinancingdebenturesandderivativefinancialinstruments</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>22</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>1170 - Disclosure - Trade payables</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Tradepayables</Role>
      <ShortName>Trade payables</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>23</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>1200 - Disclosure - Employee benefits and private pension plan</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Employeebenefitsandprivatepensionplan</Role>
      <ShortName>Employee benefits and private pension plan</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>24</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>1220 - Disclosure - Provisions and contingent liabilities</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Provisionsandcontingentliabilities</Role>
      <ShortName>Provisions and contingent liabilities</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>25</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>1240 - Disclosure - Subscription warrants - indemnification</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SubscriptionWarrantsIndemnification</Role>
      <ShortName>Subscription warrants - indemnification</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>26</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>1250 - Disclosure - Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Equity</Role>
      <ShortName>Equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>27</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>1260 - Disclosure - Costs, expenses and other operating results by nature</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Costsexpensesandotheroperatingresultsbynature</Role>
      <ShortName>Costs, expenses and other operating results by nature</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>28</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>12800 - Disclosure - Financial result</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Financialresult</Role>
      <ShortName>Financial result</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>29</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>1290 - Disclosure - Earnings per share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Earningspershare</Role>
      <ShortName>Earnings per share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>30</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>1300 - Disclosure - Segment information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Segmentinformation</Role>
      <ShortName>Segment information</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>1310 - Disclosure - Financial Instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstruments</Role>
      <ShortName>Financial Instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>1320 - Disclosure - Commitments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Commitments</Role>
      <ShortName>Commitments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>1330 - Disclosure - Acquisition of Interest and Control</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControl</Role>
      <ShortName>Acquisition of Interest and Control</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>1345 - Disclosure - Discontinued operations</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Discontinuedoperations</Role>
      <ShortName>Discontinued operations</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>1350 - Disclosure - Events after the reporting period</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/Eventsafterthereportingperiod</Role>
      <ShortName>Events after the reporting period</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>995447 - Disclosure - Insider Trading Policies and Procedures</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/ecd/role/InsiderTradingPoliciesProc</Role>
      <ShortName>Insider Trading Policies and Procedures</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>995550 - Disclosure - Cybersecurity Risk Management and Strategy Disclosure</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://xbrl.sec.gov/cyd/role/CybersecurityRiskManagementAndStrategyDisclosure</Role>
      <ShortName>Cybersecurity Risk Management and Strategy Disclosure</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>996660202 - Disclosure - Basis of preparation and presentation of consolidated financial statements (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/BasisofpreparationandpresentationofconsolidatedfinancialstatementsPolicies</Role>
      <ShortName>Basis of preparation and presentation of consolidated financial statements (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>996660301 - Disclosure - Operations (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/OperationsTables</Role>
      <ShortName>Operations (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Operations</ParentRole>
      <Position>40</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>996660304 - Disclosure - Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassetsTables</Role>
      <ShortName>Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Cashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassets</ParentRole>
      <Position>41</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>996660305 - Disclosure - Trade receivables, reseller financing and other receivables (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesTables</Role>
      <ShortName>Trade receivables, reseller financing and other receivables (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Tradereceivablesresellerfinancingandotherreceivables</ParentRole>
      <Position>42</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>996660306 - Disclosure - Inventories (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InventoriesTables</Role>
      <ShortName>Inventories (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Inventories</ParentRole>
      <Position>43</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>996660307 - Disclosure - Recoverable taxes (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RecoverabletaxesTables</Role>
      <ShortName>Recoverable taxes (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Recoverabletaxes</ParentRole>
      <Position>44</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>996660308 - Disclosure - Related Parties (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesTables</Role>
      <ShortName>Related Parties (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/RelatedParties</ParentRole>
      <Position>45</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>996660309 - Disclosure - Income and Social Contribution Taxes (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesTables</Role>
      <ShortName>Income and Social Contribution Taxes (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxes</ParentRole>
      <Position>46</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>996660311 - Disclosure - Contractual assets with customers - exclusivity rights (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ContractualassetswithcustomersexclusivityrightsTables</Role>
      <ShortName>Contractual assets with customers - exclusivity rights (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Contractualassetswithcustomersexclusivityrights</ParentRole>
      <Position>47</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>996660312 - Disclosure - Investments in subsidiaries, joint ventures and associates (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesTables</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Investmentsinsubsidiariesjointventuresandassociates</ParentRole>
      <Position>48</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>996660313 - Disclosure - Right-of-use assets and leases payable (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableTables</Role>
      <ShortName>Right-of-use assets and leases payable (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Rightofuseassetsandleasespayable</ParentRole>
      <Position>49</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>996660314 - Disclosure - Property, Plant, and Equipment (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/PropertyPlantAndEquipmentTables</Role>
      <ShortName>Property, Plant, and Equipment (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>996660315 - Disclosure - Intangible assets (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IntangibleassetsTables</Role>
      <ShortName>Intangible assets (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Intangibleassets</ParentRole>
      <Position>51</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>996660316 - Disclosure - Loans, financing, debentures and derivative financial instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsTables</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Loansfinancingdebenturesandderivativefinancialinstruments</ParentRole>
      <Position>52</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>996660317 - Disclosure - Trade Payables (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradePayablesTables</Role>
      <ShortName>Trade Payables (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>996660320 - Disclosure - Employee benefits and private pension plan (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanTables</Role>
      <ShortName>Employee benefits and private pension plan (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Employeebenefitsandprivatepensionplan</ParentRole>
      <Position>54</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>996660322 - Disclosure - Provisions and contingent liabilities (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ProvisionsandcontingentliabilitiesTables</Role>
      <ShortName>Provisions and contingent liabilities (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Provisionsandcontingentliabilities</ParentRole>
      <Position>55</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>996660324 - Disclosure - Equity (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityTables</Role>
      <ShortName>Equity (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Equity</ParentRole>
      <Position>56</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>996660325 - Disclosure - Costs, expenses and other operating results by nature (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CostsexpensesandotheroperatingresultsbynatureTables</Role>
      <ShortName>Costs, expenses and other operating results by nature (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Costsexpensesandotheroperatingresultsbynature</ParentRole>
      <Position>57</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>996660327 - Disclosure - Financial result (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialresultTables</Role>
      <ShortName>Financial result (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Financialresult</ParentRole>
      <Position>58</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>996660328 - Disclosure - Earnings per share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EarningspershareTables</Role>
      <ShortName>Earnings per share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Earningspershare</ParentRole>
      <Position>59</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>996660329 - Disclosure - Segment information (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SegmentinformationTables</Role>
      <ShortName>Segment information (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Segmentinformation</ParentRole>
      <Position>60</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R61.htm</HtmlFileName>
      <LongName>996660330 - Disclosure - Financial Instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsTables</Role>
      <ShortName>Financial Instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/FinancialInstruments</ParentRole>
      <Position>61</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R62.htm</HtmlFileName>
      <LongName>996660331 - Disclosure - Commitments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CommitmentsTables</Role>
      <ShortName>Commitments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Commitments</ParentRole>
      <Position>62</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R63.htm</HtmlFileName>
      <LongName>996660332 - Disclosure - Acquisition of Interest and Control (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControlTables</Role>
      <ShortName>Acquisition of Interest and Control (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/AcquisitionofInterestandControl</ParentRole>
      <Position>63</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R64.htm</HtmlFileName>
      <LongName>996660333 - Disclosure - Discontinued operations (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/DiscontinuedoperationsTables</Role>
      <ShortName>Discontinued operations (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/Discontinuedoperations</ParentRole>
      <Position>64</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R65.htm</HtmlFileName>
      <LongName>99666040101 - Disclosure - Operations (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/OperationsDetail</Role>
      <ShortName>Operations (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/OperationsTables</ParentRole>
      <Position>65</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R66.htm</HtmlFileName>
      <LongName>99666040102 - Disclosure - Operations - Operational impacts (Details Textuals)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/OperationsOperationalimpactsDetailsTextuals</Role>
      <ShortName>Operations - Operational impacts (Details Textuals)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>66</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R67.htm</HtmlFileName>
      <LongName>99666040401 - Disclosure - Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets - Cash and cash equivalents (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassetsCashandcashequivalentsDetail</Role>
      <ShortName>Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets - Cash and cash equivalents (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>67</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R68.htm</HtmlFileName>
      <LongName>99666040402 - Disclosure - Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets - Financial investments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassetsFinancialinvestmentsDetail</Role>
      <ShortName>Cash and cash equivalents, financial investments, derivative financial instruments and other financial assets - Financial investments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/CashandcashequivalentsfinancialinvestmentsderivativefinancialinstrumentsandotherfinancialassetsTables</ParentRole>
      <Position>68</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R69.htm</HtmlFileName>
      <LongName>99666040501 - Disclosure - Trade receivables, reseller financing and other receivables - Trade receivables (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesTradereceivablesDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - Trade receivables (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>69</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R70.htm</HtmlFileName>
      <LongName>99666040502 - Disclosure - Trade receivables, reseller financing and other receivables - Composition of Reseller Financing (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesCompositionofResellerFinancingDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - Composition of Reseller Financing (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>70</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R71.htm</HtmlFileName>
      <LongName>99666040503 - Disclosure - Trade receivables, reseller financing and other receivables - Summary of Movements in the Allowance for Loss Allowance for Expected Credit Losses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesSummaryofMovementsintheAllowanceforLossAllowanceforExpectedCreditLossesDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - Summary of Movements in the Allowance for Loss Allowance for Expected Credit Losses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>71</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R72.htm</HtmlFileName>
      <LongName>99666040504 - Disclosure - Trade receivables, reseller financing and other receivables - Summary of of Trade Receivables, Gross of Loss Allowance for Expected Credit Losses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesSummaryofofTradeReceivablesGrossofLossAllowanceforExpectedCreditLossesDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - Summary of of Trade Receivables, Gross of Loss Allowance for Expected Credit Losses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>72</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R73.htm</HtmlFileName>
      <LongName>99666040505 - Disclosure - Trade receivables, reseller financing and other receivables - sale of subsidiaries (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablessaleofsubsidiariesDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - sale of subsidiaries (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>73</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R74.htm</HtmlFileName>
      <LongName>99666040510 - Disclosure - Trade receivables, reseller financing and other receivables - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradereceivablesresellerfinancingandotherreceivablesAdditionalInformationDetail</Role>
      <ShortName>Trade receivables, reseller financing and other receivables - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>74</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R75.htm</HtmlFileName>
      <LongName>99666040601 - Disclosure - Inventories - Breakdown of Inventories (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InventoriesBreakdownofInventoriesDetail</Role>
      <ShortName>Inventories - Breakdown of Inventories (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>75</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R76.htm</HtmlFileName>
      <LongName>99666040602 - Disclosure - Inventories - Movements in the Provision for inventory Losses (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InventoriesMovementsintheProvisionforinventoryLossesDetail</Role>
      <ShortName>Inventories - Movements in the Provision for inventory Losses (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>76</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R77.htm</HtmlFileName>
      <LongName>99666040701 - Disclosure - Recoverable taxes - Summary of Recoverable Taxes (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RecoverabletaxesSummaryofRecoverableTaxesDetail</Role>
      <ShortName>Recoverable taxes - Summary of Recoverable Taxes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>77</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R78.htm</HtmlFileName>
      <LongName>99666040702 - Disclosure - Recoverable taxes - Schedule of estimated recovery of ICMS credits (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RecoverabletaxesScheduleofestimatedrecoveryofICMScreditsDetail</Role>
      <ShortName>Recoverable taxes - Schedule of estimated recovery of ICMS credits (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>78</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R79.htm</HtmlFileName>
      <LongName>99666040703 - Disclosure - Recoverable taxes - Schedule of estimated recovery of PIS and COFINS credits (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RecoverabletaxesScheduleofestimatedrecoveryofPISandCOFINScreditsDetail</Role>
      <ShortName>Recoverable taxes - Schedule of estimated recovery of PIS and COFINS credits (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>79</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R80.htm</HtmlFileName>
      <LongName>99666040704 - Disclosure - Recoverable taxes - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RecoverabletaxesAdditionalInformationDetail</Role>
      <ShortName>Recoverable taxes - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>80</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R81.htm</HtmlFileName>
      <LongName>99666040801 - Disclosure - Related Parties - Summary of Subsidiaries and Other Related Parties (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesSummaryOfSubsidiariesAndOtherRelatedPartiesDetail</Role>
      <ShortName>Related Parties - Summary of Subsidiaries and Other Related Parties (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>81</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R82.htm</HtmlFileName>
      <LongName>99666040802 - Disclosure - Related Parties - Summary of Expenses for Compensation of Its Key Executives (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesSummaryOfExpensesForCompensationOfItsKeyExecutivesDetail</Role>
      <ShortName>Related Parties - Summary of Expenses for Compensation of Its Key Executives (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>82</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R83.htm</HtmlFileName>
      <LongName>99666040803 - Disclosure - Related Parties - Restricted Stock Program (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesRestrictedStockProgramDetail</Role>
      <ShortName>Related Parties - Restricted Stock Program (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>83</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R84.htm</HtmlFileName>
      <LongName>99666040804 - Disclosure - Related Parties - Summarized Changes of Number of Restricted and Performance Shares Granted (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesSummarizedChangesOfNumberOfRestrictedAndPerformanceSharesGrantedDetail</Role>
      <ShortName>Related Parties - Summarized Changes of Number of Restricted and Performance Shares Granted (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>84</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R85.htm</HtmlFileName>
      <LongName>99666040805 - Disclosure - Related Parties - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RelatedPartiesAdditionalInformationDetail</Role>
      <ShortName>Related Parties - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>85</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R86.htm</HtmlFileName>
      <LongName>99666040901 - Disclosure - Income and Social Contribution Taxes - Deferred Taxes (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesDeferredTaxesDetail</Role>
      <ShortName>Income and Social Contribution Taxes - Deferred Taxes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>86</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R87.htm</HtmlFileName>
      <LongName>99666040902 - Disclosure - Income and Social Contribution Taxes - Summary of Changes in Balances of Deferred Taxes (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesSummaryOfChangesInBalancesOfDeferredTaxesDetail</Role>
      <ShortName>Income and Social Contribution Taxes - Summary of Changes in Balances of Deferred Taxes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>87</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R88.htm</HtmlFileName>
      <LongName>99666040903 - Disclosure - Income and Social Contribution Taxes - Summary of Reconciliation of Taxes (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesSummaryOfReconciliationOfTaxesDetail</Role>
      <ShortName>Income and Social Contribution Taxes - Summary of Reconciliation of Taxes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>88</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R89.htm</HtmlFileName>
      <LongName>99666040904 - Disclosure - Income and Social Contribution Taxes - Summary of deferred income and social contribution tax assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesSummaryOfDeferredIncomeAndSocialContributionTaxAssetsDetail</Role>
      <ShortName>Income and Social Contribution Taxes - Summary of deferred income and social contribution tax assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>89</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R90.htm</HtmlFileName>
      <LongName>99666040905 - Disclosure - Income and Social Contribution Taxes - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IncomeAndSocialContributionTaxesAdditionalInformationDetail</Role>
      <ShortName>Income and Social Contribution Taxes - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>90</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R91.htm</HtmlFileName>
      <LongName>99666041001 - Disclosure - Contractual assets with customers - exclusivity rights - Summary of Contractual Assets with Customers Exclusive Rights Balance and Changes (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ContractualassetswithcustomersexclusivityrightsSummaryofContractualAssetswithCustomersExclusiveRightsBalanceandChangesDetail</Role>
      <ShortName>Contractual assets with customers - exclusivity rights - Summary of Contractual Assets with Customers Exclusive Rights Balance and Changes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>91</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R92.htm</HtmlFileName>
      <LongName>99666041101 - Disclosure - Investments in subsidiaries, joint ventures and associates - Summary of the positions of equity and income (loss) for the year (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesSummaryofthepositionsofequityandincomelossfortheyearDetails</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates - Summary of the positions of equity and income (loss) for the year (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>92</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R93.htm</HtmlFileName>
      <LongName>99666041102 - Disclosure - Investments in subsidiaries, joint ventures and associates - Summary of financial position and income of subsidiaries which have relevant non-controlling interests (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesSummaryoffinancialpositionandincomeofsubsidiarieswhichhaverelevantnoncontrollinginterestsDetail</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates - Summary of financial position and income of subsidiaries which have relevant non-controlling interests (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>93</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R94.htm</HtmlFileName>
      <LongName>99666041103 - Disclosure - Investments in subsidiaries, joint ventures and associates - Summary of statements of financial information of joint ventures and associates (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesSummaryofstatementsoffinancialinformationofjointventuresandassociatesDetail</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates - Summary of statements of financial information of joint ventures and associates (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>94</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R95.htm</HtmlFileName>
      <LongName>99666041104 - Disclosure - Investments in subsidiaries, joint ventures and associates - Summary of balances and changes in investments in joint ventures and associates (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesSummaryofbalancesandchangesininvestmentsinjointventuresandassociatesDetail</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates - Summary of balances and changes in investments in joint ventures and associates (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>95</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R96.htm</HtmlFileName>
      <LongName>99666041105 - Disclosure - Investments in subsidiaries, joint ventures and associates (Details - Textuals)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesDetailsTextuals</Role>
      <ShortName>Investments in subsidiaries, joint ventures and associates (Details - Textuals)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/InvestmentsinsubsidiariesjointventuresandassociatesTables</ParentRole>
      <Position>96</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R97.htm</HtmlFileName>
      <LongName>99666041201 - Disclosure - Right-of-use assets and leases payable - Summary of Information About Right of Use Assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableSummaryofInformationAboutRightofUseAssetsDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Summary of Information About Right of Use Assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>97</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R98.htm</HtmlFileName>
      <LongName>99666041202 - Disclosure - Right-of-use assets and leases payable - Summary of Information About Right of Use Assets (Detail) (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableSummaryofInformationAboutRightofUseAssetsDetailParenthetical</Role>
      <ShortName>Right-of-use assets and leases payable - Summary of Information About Right of Use Assets (Detail) (Parenthetical)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>98</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R99.htm</HtmlFileName>
      <LongName>99666041203 - Disclosure - Right-of-use assets and leases payable - Summary of Changes in Lease Payables (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableSummaryofChangesinLeasePayablesDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Summary of Changes in Lease Payables (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>99</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R100.htm</HtmlFileName>
      <LongName>99666041204 - Disclosure - Right-of-use assets and leases payable - Summary of Maturities of Lease Payments of Operating Lease (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableSummaryofMaturitiesofLeasePaymentsofOperatingLeaseDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Summary of Maturities of Lease Payments of Operating Lease (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>100</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R101.htm</HtmlFileName>
      <LongName>99666041205 - Disclosure - Right-of-use assets and leases payable - Summary of weighted average discount rates for the lease payable (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableSummaryofweightedaveragediscountratesfortheleasepayableDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Summary of weighted average discount rates for the lease payable (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>101</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R102.htm</HtmlFileName>
      <LongName>99666041206 - Disclosure - Right-of-use assets and leases payable - Details about lease contracts of low amount assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableDetailsaboutleasecontractsoflowamountassetsDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Details about lease contracts of low amount assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>102</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R103.htm</HtmlFileName>
      <LongName>99666041207 - Disclosure - Right-of-use assets and leases payable - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/RightofuseassetsandleasespayableAdditionalInformationDetail</Role>
      <ShortName>Right-of-use assets and leases payable - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>103</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R104.htm</HtmlFileName>
      <LongName>99666041301 - Disclosure - Property, Plant,and Equipment - Balances and changes in property, plant, and equipment beginning and ending (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/PropertyPlantAndEquipmentBalancesAndChangesInPropertyPlantAndEquipmentBeginningAndEndingDetail</Role>
      <ShortName>Property, Plant,and Equipment - Balances and changes in property, plant, and equipment beginning and ending (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>104</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R105.htm</HtmlFileName>
      <LongName>99666041302 - Disclosure - Intangible assets - Balance and changes in intangible assets (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IntangibleassetsBalanceandchangesinintangibleassetsDetail</Role>
      <ShortName>Intangible assets - Balance and changes in intangible assets (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>105</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R106.htm</HtmlFileName>
      <LongName>99666041401 - Disclosure - Intangible assets - Transfer to property, plant and equipment (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IntangibleassetsTransfertopropertyplantandequipmentDetail</Role>
      <ShortName>Intangible assets - Transfer to property, plant and equipment (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>106</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R107.htm</HtmlFileName>
      <LongName>99666041402 - Disclosure - Intangible assets - Balances of goodwill (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IntangibleassetsBalancesofgoodwillDetail</Role>
      <ShortName>Intangible assets - Balances of goodwill (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>107</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R108.htm</HtmlFileName>
      <LongName>99666041404 - Disclosure - Intangible assets - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/IntangibleassetsAdditionalInformationDetail</Role>
      <ShortName>Intangible assets - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>108</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R109.htm</HtmlFileName>
      <LongName>99666041501 - Disclosure - Loans, financing, debentures and derivative financial instruments - Summary of Compostion of loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsSummaryofCompostionofloansDetail</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments - Summary of Compostion of loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>109</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R110.htm</HtmlFileName>
      <LongName>99666041502 - Disclosure - Loans, financing, debentures and derivative financial instruments - Summary of Changes in Loans, Debentures and Finance Leases (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsSummaryofChangesinLoansDebenturesandFinanceLeasesDetail</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments - Summary of Changes in Loans, Debentures and Finance Leases (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>110</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R111.htm</HtmlFileName>
      <LongName>99666041506 - Disclosure - Loans, financing, debentures and derivative financial instruments - Summary of main operations contracted loans (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsSummaryofmainoperationscontractedloansDetail</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments - Summary of main operations contracted loans (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>111</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R112.htm</HtmlFileName>
      <LongName>99666041507 - Disclosure - Loans, financing, debentures and derivative financial instruments - Summary of Debentures (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsSummaryofDebenturesDetail</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments - Summary of Debentures (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>112</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R113.htm</HtmlFileName>
      <LongName>99666041511 - Disclosure - Loans, financing, debentures and derivative financial instruments - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/LoansfinancingdebenturesandderivativefinancialinstrumentsAdditionalInformationDetail</Role>
      <ShortName>Loans, financing, debentures and derivative financial instruments - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>113</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R114.htm</HtmlFileName>
      <LongName>99666041601 - Disclosure - Trade Payables - Summary of Trade Payables (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/TradePayablesSummaryOfTradePayablesDetail</Role>
      <ShortName>Trade Payables - Summary of Trade Payables (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>114</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R115.htm</HtmlFileName>
      <LongName>99666041701 - Disclosure - Employee benefits and private pension plan - Additional information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanAdditionalinformationDetail</Role>
      <ShortName>Employee benefits and private pension plan - Additional information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>115</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R116.htm</HtmlFileName>
      <LongName>99666041702 - Disclosure - Employee benefits and private pension plan - Post-employment Benefits (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanPostemploymentBenefitsDetail</Role>
      <ShortName>Employee benefits and private pension plan - Post-employment Benefits (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>116</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R117.htm</HtmlFileName>
      <LongName>99666041703 - Disclosure - Employee benefits and private pension plan - Changes in provision for post-employment benefits (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanChangesinprovisionforpostemploymentbenefitsDetail</Role>
      <ShortName>Employee benefits and private pension plan - Changes in provision for post-employment benefits (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>117</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R118.htm</HtmlFileName>
      <LongName>99666041704 - Disclosure - Employee benefits and private pension plan - Post-employment benefit expense (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanPostemploymentbenefitexpenseDetail</Role>
      <ShortName>Employee benefits and private pension plan - Post-employment benefit expense (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>118</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R119.htm</HtmlFileName>
      <LongName>99666041705 - Disclosure - Employee benefits and private pension plan - Significant actuarial assumptions adopted (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanSignificantactuarialassumptionsadoptedDetail</Role>
      <ShortName>Employee benefits and private pension plan - Significant actuarial assumptions adopted (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>119</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R120.htm</HtmlFileName>
      <LongName>99666041706 - Disclosure - Employee benefits and private pension plan - Sensitivity analysis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EmployeebenefitsandprivatepensionplanSensitivityanalysisDetail</Role>
      <ShortName>Employee benefits and private pension plan - Sensitivity analysis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>120</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R121.htm</HtmlFileName>
      <LongName>99666041801 - Disclosure - Provisions and contingent liabilities - Breakdown of provisions by nature (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ProvisionsandcontingentliabilitiesBreakdownofprovisionsbynatureDetail</Role>
      <ShortName>Provisions and contingent liabilities - Breakdown of provisions by nature (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>121</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R122.htm</HtmlFileName>
      <LongName>99666041802 - Disclosure - Provisions and contingent liabilities - Balances of escrow deposits (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ProvisionsandcontingentliabilitiesBalancesofescrowdepositsDetail</Role>
      <ShortName>Provisions and contingent liabilities - Balances of escrow deposits (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>122</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R123.htm</HtmlFileName>
      <LongName>99666041803 - Disclosure - Provisions and contingent liabilities - Contingent liabilities (possible) by nature (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ProvisionsandcontingentliabilitiesContingentliabilitiespossiblebynatureDetail</Role>
      <ShortName>Provisions and contingent liabilities - Contingent liabilities (possible) by nature (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>123</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R124.htm</HtmlFileName>
      <LongName>99666041804 - Disclosure - Provisions and contingent liabilities - Additional information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/ProvisionsandcontingentliabilitiesAdditionalinformationDetail</Role>
      <ShortName>Provisions and contingent liabilities - Additional information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>124</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R125.htm</HtmlFileName>
      <LongName>99666041901 - Disclosure - Subscription warrants - indemnification - Additional information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SubscriptionWarrantsIndemnificationAdditionalInformationDetail</Role>
      <ShortName>Subscription warrants - indemnification - Additional information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>125</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R126.htm</HtmlFileName>
      <LongName>99666042001 - Disclosure - Equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityAdditionalInformationDetail</Role>
      <ShortName>Equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>126</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R127.htm</HtmlFileName>
      <LongName>99666042002 - Disclosure - Equity - Balance of treasury shares (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityBalanceoftreasurysharesDetail</Role>
      <ShortName>Equity - Balance of treasury shares (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>127</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R128.htm</HtmlFileName>
      <LongName>99666042003 - Disclosure - Equity - Balance of Other Comprehensive Income (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityBalanceOfOtherComprehensiveIncomeDetail</Role>
      <ShortName>Equity - Balance of Other Comprehensive Income (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>128</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R129.htm</HtmlFileName>
      <LongName>99666042004 - Disclosure - Equity - Dividends and Allocation of Net Income (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityDividendsAndAllocationOfNetIncomeDetail</Role>
      <ShortName>Equity - Dividends and Allocation of Net Income (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>129</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R130.htm</HtmlFileName>
      <LongName>99666042006 - Disclosure - Equity - Dividends and Allocation of Net Income (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquityDividendsAndAllocationOfNetIncomeParentheticalDetail</Role>
      <ShortName>Equity - Dividends and Allocation of Net Income (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>130</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R131.htm</HtmlFileName>
      <LongName>99666042007 - Disclosure - Equity - Summary of Balances and Changes in Dividends Payable (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EquitySummaryofBalancesandChangesinDividendsPayableDetail</Role>
      <ShortName>Equity - Summary of Balances and Changes in Dividends Payable (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>131</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R132.htm</HtmlFileName>
      <LongName>99666042101 - Disclosure - Costs, expenses and other operating results by nature - Costs and expenses by nature (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CostsexpensesandotheroperatingresultsbynatureCostsandexpensesbynatureDetail</Role>
      <ShortName>Costs, expenses and other operating results by nature - Costs and expenses by nature (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>132</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R133.htm</HtmlFileName>
      <LongName>99666042201 - Disclosure - Financial result - Financial result (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialresultFinancialresultDetail</Role>
      <ShortName>Financial result - Financial result (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>133</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R134.htm</HtmlFileName>
      <LongName>99666042301 - Disclosure - Earnings per share - Basic and Diluted Earnings per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EarningspershareBasicandDilutedEarningsperShareDetail</Role>
      <ShortName>Earnings per share - Basic and Diluted Earnings per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>134</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R135.htm</HtmlFileName>
      <LongName>99666042302 - Disclosure - Earnings per share - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EarningspershareAdditionalInformationDetail</Role>
      <ShortName>Earnings per share - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>135</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R136.htm</HtmlFileName>
      <LongName>99666042401 - Disclosure - Segment Information - Revenue from Operations Abroad (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SegmentInformationRevenueFromOperationsAbroadDetail</Role>
      <ShortName>Segment Information - Revenue from Operations Abroad (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>136</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R137.htm</HtmlFileName>
      <LongName>99666042402 - Disclosure - Segment information - Financial Information of Segments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SegmentinformationFinancialInformationofSegmentsDetail</Role>
      <ShortName>Segment information - Financial Information of Segments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>137</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R138.htm</HtmlFileName>
      <LongName>99666042403 - Disclosure - Segment Information - Assets By Segments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/SegmentInformationAssetsBySegmentsDetail</Role>
      <ShortName>Segment Information - Assets By Segments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>138</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R139.htm</HtmlFileName>
      <LongName>99666042501 - Disclosure - Financial Instruments - Summary of the financial assets and financial liabilities measured at fair value (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsSummaryofthefinancialassetsandfinancialliabilitiesmeasuredatfairvalueDetail</Role>
      <ShortName>Financial Instruments - Summary of the financial assets and financial liabilities measured at fair value (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>139</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R140.htm</HtmlFileName>
      <LongName>99666042502 - Disclosure - Financial Instruments - Changes in financial liabilities measured at level 3 of the fair value hierarchy (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsChangesinfinancialliabilitiesmeasuredatlevel3ofthefairvaluehierarchyDetail</Role>
      <ShortName>Financial Instruments - Changes in financial liabilities measured at level 3 of the fair value hierarchy (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>140</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R141.htm</HtmlFileName>
      <LongName>99666042503 - Disclosure - Financial Instruments -  (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsDetail</Role>
      <ShortName>Financial Instruments -  (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/FinancialInstrumentsTables</ParentRole>
      <Position>141</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R142.htm</HtmlFileName>
      <LongName>99666042504 - Disclosure - Financial Instruments - Assets and liabilities exposed to foreign currency, translated to Reais, and/or exposed to floating interest rates (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsAssetsandliabilitiesexposedtoforeigncurrencytranslatedtoReaisandorexposedtofloatinginterestratesDetail</Role>
      <ShortName>Financial Instruments - Assets and liabilities exposed to foreign currency, translated to Reais, and/or exposed to floating interest rates (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>142</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R143.htm</HtmlFileName>
      <LongName>99666042506 - Disclosure - Financial Instruments - Sensitivity analysis with devaluation of the Real and interest rate increase (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsSensitivityanalysiswithdevaluationoftheRealandinterestrateincreaseDetail</Role>
      <ShortName>Financial Instruments - Sensitivity analysis with devaluation of the Real and interest rate increase (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>143</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R144.htm</HtmlFileName>
      <LongName>99666042507 - Disclosure - Financial Instruments - Positions of derivative financial instruments to hedge commodity price risk (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsPositionsofderivativefinancialinstrumentstohedgecommoditypriceriskDetail</Role>
      <ShortName>Financial Instruments - Positions of derivative financial instruments to hedge commodity price risk (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>144</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R145.htm</HtmlFileName>
      <LongName>99666042508 - Disclosure - Financial Instruments - Summary of credit risk of financial institution and government of cash, cash equivalents and financial investments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsSummaryofcreditriskoffinancialinstitutionandgovernmentofcashcashequivalentsandfinancialinvestmentsDetail</Role>
      <ShortName>Financial Instruments - Summary of credit risk of financial institution and government of cash, cash equivalents and financial investments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>145</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R146.htm</HtmlFileName>
      <LongName>99666042509 - Disclosure - Financial Instruments - Contractual undiscounted cash outflows (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsContractualundiscountedcashoutflowsDetail</Role>
      <ShortName>Financial Instruments - Contractual undiscounted cash outflows (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>146</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R147.htm</HtmlFileName>
      <LongName>99666042510 - Disclosure - Financial Instruments - Schedule of leverage ratio (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsScheduleofleverageratioDetail</Role>
      <ShortName>Financial Instruments - Schedule of leverage ratio (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>147</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R148.htm</HtmlFileName>
      <LongName>99666042511 - Disclosure - Financial Instruments - Summary the position of hedging instruments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsSummarythepositionofhedginginstrumentsDetail</Role>
      <ShortName>Financial Instruments - Summary the position of hedging instruments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>148</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R149.htm</HtmlFileName>
      <LongName>99666042512 - Disclosure - Financial Instruments - Sensitivity analysis level 2 hierarchy (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsSensitivityanalysislevel2hierarchyDetail</Role>
      <ShortName>Financial Instruments - Sensitivity analysis level 2 hierarchy (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>149</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R150.htm</HtmlFileName>
      <LongName>99666042513 - Disclosure - Financial Instruments - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/FinancialInstrumentsAdditionalInformationDetail</Role>
      <ShortName>Financial Instruments - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>150</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R151.htm</HtmlFileName>
      <LongName>99666042701 - Disclosure - Commitments - Contracts (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CommitmentsContractsDetail</Role>
      <ShortName>Commitments - Contracts (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>151</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R152.htm</HtmlFileName>
      <LongName>99666042702 - Disclosure - Commitments - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/CommitmentsAdditionalInformationDetail</Role>
      <ShortName>Commitments - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>152</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R153.htm</HtmlFileName>
      <LongName>99666042801 - Disclosure - Acquisition of Interest and Control - Schedule of transaction amounts for acquiring an interest (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControlScheduleoftransactionamountsforacquiringaninterestDetails</Role>
      <ShortName>Acquisition of Interest and Control - Schedule of transaction amounts for acquiring an interest (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>153</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R154.htm</HtmlFileName>
      <LongName>99666042802 - Disclosure - Acquisition of Interest and Control - Schedule of the provisional balances of assets acquired and liabilities assumed on the acquisition date (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControlScheduleoftheprovisionalbalancesofassetsacquiredandliabilitiesassumedontheacquisitiondateDetails</Role>
      <ShortName>Acquisition of Interest and Control - Schedule of the provisional balances of assets acquired and liabilities assumed on the acquisition date (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>154</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R155.htm</HtmlFileName>
      <LongName>99666042803 - Disclosure - Acquisition of Interest and Control - Schedule of acquired intangible assets that were not recognized in the books of the acquired entity (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControlScheduleofacquiredintangibleassetsthatwerenotrecognizedinthebooksoftheacquiredentityDetails</Role>
      <ShortName>Acquisition of Interest and Control - Schedule of acquired intangible assets that were not recognized in the books of the acquired entity (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>155</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R156.htm</HtmlFileName>
      <LongName>99666042804 - Disclosure - Acquisition of Interest and Control - Additional Information (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/AcquisitionofInterestandControlAdditionalInformationDetails</Role>
      <ShortName>Acquisition of Interest and Control - Additional Information (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>156</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R157.htm</HtmlFileName>
      <LongName>99666042901 - Disclosure - Discontinued operations (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/DiscontinuedoperationsDetails</Role>
      <ShortName>Discontinued operations (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/DiscontinuedoperationsTables</ParentRole>
      <Position>157</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R158.htm</HtmlFileName>
      <LongName>99666042902 - Disclosure - Discontinued operations (Details Textuals)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/DiscontinuedoperationsDetailsTextuals</Role>
      <ShortName>Discontinued operations (Details Textuals)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.ultrapar.com/role/DiscontinuedoperationsTables</ParentRole>
      <Position>158</Position>
    </Report>
    <Report instance="ugp-20241231.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R159.htm</HtmlFileName>
      <LongName>99666043001 - Disclosure - Events after the reporting period - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.ultrapar.com/role/EventsafterthereportingperiodAdditionalInformationDetail</Role>
      <ShortName>Events after the reporting period - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>159</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="20-F" isDefinitelyFs="true" isIfrs="true" isUsgaap="true" original="ugp-20241231.htm">ugp-20241231.htm</File>
    <File>ugp-20241231.xsd</File>
    <File>ugp-20241231_cal.xml</File>
    <File>ugp-20241231_def.xml</File>
    <File>ugp-20241231_lab.xml</File>
    <File>ugp-20241231_pre.xml</File>
  </InputFiles>
  <SupplementalFiles>
    <File>img076eac17df5f424e93cf.jpg</File>
    <File>img1bfd1b573a7c4a6fa78f.jpg</File>
    <File>img270e6ab3afe44a1d8f92.jpg</File>
    <File>img3549742155ac4ec7a869.jpg</File>
    <File>img380f5822f2a5477aad80.jpg</File>
    <File>img3c1c22cd913c4015aa6b.jpg</File>
    <File>img63af2587c1fa4c65b998.jpg</File>
    <File>img668e2ed3cdda4cd58b55.jpg</File>
    <File>img74a0c60d011d4ad8b1df.jpg</File>
    <File>img85429fd0e42049428a67.jpg</File>
    <File>img8566f3e987b74a389400.jpg</File>
    <File>img9a1bf3c4abf74e7bb213.jpg</File>
    <File>imga0efe82ddcfc4cd4af04.jpg</File>
    <File>imge7cb6a7d63df4f9b9c0b.jpg</File>
    <File>imgeaddc845df19495c88a6.jpg</File>
  </SupplementalFiles>
  <BaseTaxonomies>
    <BaseTaxonomy items="1">http://fasb.org/srt/2024</BaseTaxonomy>
    <BaseTaxonomy items="16">http://xbrl.sec.gov/cyd/2024</BaseTaxonomy>
    <BaseTaxonomy items="42">http://xbrl.sec.gov/dei/2024</BaseTaxonomy>
    <BaseTaxonomy items="1">http://xbrl.sec.gov/ecd/2024</BaseTaxonomy>
    <BaseTaxonomy items="3714">https://xbrl.ifrs.org/taxonomy/2024-03-27/ifrs-full</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
