<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.22.2</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>456</ContextCount>
  <ElementCount>285</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>122</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>10</UnitCount>
  <MyReports>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>100000 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DocumentDocumentAndEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>100010 - Statement - Condensed Consolidated Statements of Income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/StatementCondensedConsolidatedStatementsOfIncome</Role>
      <ShortName>Condensed Consolidated Statements of Income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>100020 - Statement - Condensed Consolidated Statements of Comprehensive Income</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/StatementCondensedConsolidatedStatementsOfComprehensiveIncome</Role>
      <ShortName>Condensed Consolidated Statements of Comprehensive Income</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>100030 - Statement - Condensed Consolidated Balance Sheets</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/StatementCondensedConsolidatedBalanceSheets</Role>
      <ShortName>Condensed Consolidated Balance Sheets</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>100040 - Statement - Condensed Consolidated Statements of Changes in Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/StatementCondensedConsolidatedStatementsOfChangesInEquity</Role>
      <ShortName>Condensed Consolidated Statements of Changes in Equity</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>100050 - Statement - Condensed Consolidated Statements of Cash Flows</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/StatementCondensedConsolidatedStatementsOfCashFlows</Role>
      <ShortName>Condensed Consolidated Statements of Cash Flows</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>100060 - Disclosure - General</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureGeneral</Role>
      <ShortName>General</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>100070 - Disclosure - Relationship with Universal Health Realty Income Trust and Other Related Party Transactions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRelationshipWithUniversalHealthRealtyIncomeTrustAndOtherRelatedPartyTransactions</Role>
      <ShortName>Relationship with Universal Health Realty Income Trust and Other Related Party Transactions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>100080 - Disclosure - Other Noncurrent liabilities and Redeemable/Noncontrolling Interests</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureOtherNoncurrentLiabilitiesAndRedeemableNoncontrollingInterests</Role>
      <ShortName>Other Noncurrent liabilities and Redeemable/Noncontrolling Interests</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>100090 - Disclosure - Treasury</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureTreasury</Role>
      <ShortName>Treasury</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>100100 - Disclosure - Fair Value Measurement</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureFairValueMeasurement</Role>
      <ShortName>Fair Value Measurement</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>100110 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureCommitmentsAndContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>100120 - Disclosure - Segment Reporting</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReporting</Role>
      <ShortName>Segment Reporting</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>100130 - Disclosure - Earnings Per Share Data ("EPS") and Stock Based Compensation</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureEarningsPerShareDataEPSAndStockBasedCompensation</Role>
      <ShortName>Earnings Per Share Data ("EPS") and Stock Based Compensation</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>100140 - Disclosure - Dispositions and acquisitions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureDispositionsAndAcquisitions</Role>
      <ShortName>Dispositions and acquisitions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>100150 - Disclosure - Dividends</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureDividends</Role>
      <ShortName>Dividends</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>100160 - Disclosure - Income Taxes</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureIncomeTaxes</Role>
      <ShortName>Income Taxes</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>100170 - Disclosure - Revenue</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRevenue</Role>
      <ShortName>Revenue</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>100180 - Disclosure - Lease Accounting</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureLeaseAccounting</Role>
      <ShortName>Lease Accounting</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>19</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>100190 - Disclosure - Recent Accounting Standards</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRecentAccountingStandards</Role>
      <ShortName>Recent Accounting Standards</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>20</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>100200 - Disclosure - Relationship with Universal Health Realty Income Trust and Other Related Party Transactions (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRelationshipWithUniversalHealthRealtyIncomeTrustAndOtherRelatedPartyTransactionsTables</Role>
      <ShortName>Relationship with Universal Health Realty Income Trust and Other Related Party Transactions (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRelationshipWithUniversalHealthRealtyIncomeTrustAndOtherRelatedPartyTransactions</ParentRole>
      <Position>21</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>100210 - Disclosure - Treasury (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureTreasuryTables</Role>
      <ShortName>Treasury (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureTreasury</ParentRole>
      <Position>22</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>100220 - Disclosure - Fair Value Measurement (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureFairValueMeasurementTables</Role>
      <ShortName>Fair Value Measurement (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureFairValueMeasurement</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>100230 - Disclosure - Segment Reporting (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReportingTables</Role>
      <ShortName>Segment Reporting (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReporting</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>100240 - Disclosure - Earnings Per Share Data ("EPS") and Stock Based Compensation (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureEarningsPerShareDataEPSAndStockBasedCompensationTables</Role>
      <ShortName>Earnings Per Share Data ("EPS") and Stock Based Compensation (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureEarningsPerShareDataEPSAndStockBasedCompensation</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>100250 - Disclosure - Revenue (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRevenueTables</Role>
      <ShortName>Revenue (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRevenue</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>100260 - Disclosure - Lease Accounting (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureLeaseAccountingTables</Role>
      <ShortName>Lease Accounting (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureLeaseAccounting</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>100270 - Disclosure - General - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureGeneralAdditionalInformationDetail</Role>
      <ShortName>General - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>28</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>100280 - Disclosure - Relationship with Universal Health Realty Income Trust and Other Related Party Transactions - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureRelationshipWithUniversalHealthRealtyIncomeTrustAndOtherRelatedPartyTransactionsAdditionalInformationDetail</Role>
      <ShortName>Relationship with Universal Health Realty Income Trust and Other Related Party Transactions - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>29</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>100290 - Disclosure - Summary of Details of Hospitals Leased from Trust (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSummaryOfDetailsOfHospitalsLeasedFromTrustDetail</Role>
      <ShortName>Summary of Details of Hospitals Leased from Trust (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>30</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>100300 - Disclosure - Summary of Details of Hospitals Leased from Trust (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSummaryOfDetailsOfHospitalsLeasedFromTrustParentheticalDetail</Role>
      <ShortName>Summary of Details of Hospitals Leased from Trust (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>100310 - Disclosure - Other Noncurrent Liabilities and Redeemable/Noncontrolling Interests - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureOtherNoncurrentLiabilitiesAndRedeemableNoncontrollingInterestsAdditionalInformationDetail</Role>
      <ShortName>Other Noncurrent Liabilities and Redeemable/Noncontrolling Interests - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>100320 - Disclosure - Treasury - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureTreasuryAdditionalInformationDetail</Role>
      <ShortName>Treasury - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>100330 - Disclosure - Summary of Effects of Foreign Currency Foreign Exchange Contracts on Result of Operations (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSummaryOfEffectsOfForeignCurrencyForeignExchangeContractsOnResultOfOperationsDetail</Role>
      <ShortName>Summary of Effects of Foreign Currency Foreign Exchange Contracts on Result of Operations (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>100340 - Disclosure - Summary of Cash, Cash Equivalents and Restricted Cash Reported In Condensed Consolidated Statements of Cash Flows (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSummaryOfCashCashEquivalentsAndRestrictedCashReportedInCondensedConsolidatedStatementsOfCashFlowsDetail</Role>
      <ShortName>Summary of Cash, Cash Equivalents and Restricted Cash Reported In Condensed Consolidated Statements of Cash Flows (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>100350 - Disclosure - Summary of Assets and Liabilities Recorded at Fair Value on Recurring Basis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSummaryOfAssetsAndLiabilitiesRecordedAtFairValueOnRecurringBasisDetail</Role>
      <ShortName>Summary of Assets and Liabilities Recorded at Fair Value on Recurring Basis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>100360 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureCommitmentsAndContingenciesAdditionalInformationDetail</Role>
      <ShortName>Commitments and Contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>100370 - Disclosure - Segment Reporting (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReportingDetail</Role>
      <ShortName>Segment Reporting (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReportingTables</ParentRole>
      <Position>38</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>100380 - Disclosure - Segment Reporting (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReportingParentheticalDetail</Role>
      <ShortName>Segment Reporting (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSegmentReportingTables</ParentRole>
      <Position>39</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>100390 - Disclosure - Computation of Basic and Diluted Earnings Per Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureComputationOfBasicAndDilutedEarningsPerShareDetail</Role>
      <ShortName>Computation of Basic and Diluted Earnings Per Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>100400 - Disclosure - Earnings Per Share Data ("EPS") and Stock Based Compensation - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureEarningsPerShareDataEPSAndStockBasedCompensationAdditionalInformationDetail</Role>
      <ShortName>Earnings Per Share Data ("EPS") and Stock Based Compensation - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureEarningsPerShareDataEPSAndStockBasedCompensationTables</ParentRole>
      <Position>41</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>100410 - Disclosure - Dispositions and Acquisitions - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureDispositionsAndAcquisitionsAdditionalInformationDetail</Role>
      <ShortName>Dispositions and Acquisitions - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>100420 - Disclosure - Dividends - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureDividendsAdditionalInformationDetail</Role>
      <ShortName>Dividends - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>100430 - Disclosure - Income Taxes - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureIncomeTaxesAdditionalInformationDetail</Role>
      <ShortName>Income Taxes - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>100440 - Disclosure - Schedule of Disaggregates Revenue by Major Source (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureScheduleOfDisaggregatesRevenueByMajorSourceDetail</Role>
      <ShortName>Schedule of Disaggregates Revenue by Major Source (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>100450 - Disclosure - Lease Accounting - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureLeaseAccountingAdditionalInformationDetail</Role>
      <ShortName>Lease Accounting - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>46</Position>
    </Report>
    <Report instance="uhs-10q_20220630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>100460 - Disclosure - Supplemental Cash Flow Information Related to Leases (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.uhsinc.com/20220630/taxonomy/role/DisclosureSupplementalCashFlowInformationRelatedToLeasesDetail</Role>
      <ShortName>Supplemental Cash Flow Information Related to Leases (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" original="uhs-10q_20220630.htm">uhs-10q_20220630.htm</File>
    <File>uhs-20220630.xsd</File>
    <File>uhs-20220630_cal.xml</File>
    <File>uhs-20220630_def.xml</File>
    <File>uhs-20220630_lab.xml</File>
    <File>uhs-20220630_pre.xml</File>
    <File>uhs-ex104_238.htm</File>
    <File>uhs-ex105_27.htm</File>
    <File>uhs-ex311_13.htm</File>
    <File>uhs-ex312_12.htm</File>
    <File>uhs-ex321_9.htm</File>
    <File>uhs-ex322_11.htm</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="844">http://fasb.org/us-gaap/2022</BaseTaxonomy>
    <BaseTaxonomy items="33">http://xbrl.sec.gov/dei/2022</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>true</HasPresentationLinkbase>
  <HasCalculationLinkbase>true</HasCalculationLinkbase>
</FilingSummary>
