<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2026"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="uhs-20260817.xsd" xlink:type="simple"/>
    <context id="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000352915</identifier>
        </entity>
        <period>
            <startDate>2026-08-17</startDate>
            <endDate>2026-08-17</endDate>
        </period>
    </context>
    <dei:AmendmentFlag
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_0645ea20-713f-4b1c-8efa-8c7888a82f9b">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_4c4f85ca-abba-4de5-936d-dcbd4627d725">0000352915</dei:EntityCentralIndexKey>
    <dei:DocumentType
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_f611a3dd-d7b5-4adc-b9cc-0ba920b690f4">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_2acf3f80-0a04-430d-88f6-ec56ee8922fb">2026-08-17</dei:DocumentPeriodEndDate>
    <dei:EntityRegistrantName
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_2764dcda-f0eb-41ce-a7ef-aadac1c9dbb7">UNIVERSAL HEALTH SERVICES, INC.</dei:EntityRegistrantName>
    <dei:EntityIncorporationStateCountryCode
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_116d660a-1603-4fb1-b958-aff3f327c1f3">DE</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_6d401171-5c85-472f-8c37-f0deab237a55">1-10765</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_624539be-9978-45cf-be0e-31aea6b1417c">23-2077891</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_88b296e6-e25d-4bc5-8921-98bdb1c4263d">UNIVERSAL CORPORATE CENTER</dei:EntityAddressAddressLine1>
    <dei:EntityAddressAddressLine2
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_5edab230-e2b0-41c1-8e01-25b6ca52e2be">367 SOUTH GULPH ROAD</dei:EntityAddressAddressLine2>
    <dei:EntityAddressCityOrTown
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_7e7e0440-3ac6-4776-8656-a3a1698691cd">KING OF PRUSSIA</dei:EntityAddressCityOrTown>
    <dei:EntityAddressStateOrProvince
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_9c18bd76-9e6b-4227-b3b4-3fc4ad8374ac">PA</dei:EntityAddressStateOrProvince>
    <dei:EntityAddressPostalZipCode
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_310305da-cbca-4af2-9322-b56560660c91">19406</dei:EntityAddressPostalZipCode>
    <dei:CityAreaCode
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_06abdec7-be01-4e60-8d45-ddd7ea694f88">(610)</dei:CityAreaCode>
    <dei:LocalPhoneNumber
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_d3587894-e039-447d-a81e-4dbc330cf9bd">768-3300</dei:LocalPhoneNumber>
    <dei:WrittenCommunications
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_2aa8b147-14bb-4430-b0f8-8802e02648d7">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_eab826d8-8b30-4919-944a-6e14686a75f0">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_4b971091-7918-486f-8012-988109bf5934">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_91837254-7a8b-4502-a0cc-a815ca00e517">false</dei:PreCommencementIssuerTenderOffer>
    <dei:Security12bTitle
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_277f21b9-84ec-402e-a033-a0088e2abf32">Class B Common Stock</dei:Security12bTitle>
    <dei:TradingSymbol
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_7b3c0730-d06a-414a-b4d9-ee18974f285a">UHS</dei:TradingSymbol>
    <dei:SecurityExchangeName
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_b2646b5c-6813-4718-b465-41091b78994e">NYSE</dei:SecurityExchangeName>
    <dei:EntityEmergingGrowthCompany
      contextRef="C_6d2c876f-faf7-42d5-a538-f8e83bcdd5ef"
      id="F_3a9ffee2-81f3-45fa-b6a9-ee306df136db">false</dei:EntityEmergingGrowthCompany>
</xbrl>
