<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:cef="http://xbrl.sec.gov/cef/2026"
  xmlns:dei="http://xbrl.sec.gov/dei/2026"
  xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xlink="http://www.w3.org/1999/xlink">
    <link:schemaRef xlink:href="ocsl-20260916.xsd" xlink:type="simple"/>
    <context id="P09_16_2026To09_16_2026">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001414932</identifier>
        </entity>
        <period>
            <startDate>2026-09-16</startDate>
            <endDate>2026-09-16</endDate>
        </period>
    </context>
    <unit id="Unit_USD">
        <measure>iso4217:USD</measure>
    </unit>
    <dei:EntityRegistrantName contextRef="P09_16_2026To09_16_2026" id="hidden171754246">Oaktree Specialty Lending Corp</dei:EntityRegistrantName>
    <dei:AmendmentFlag contextRef="P09_16_2026To09_16_2026" id="ixv-309">false</dei:AmendmentFlag>
    <dei:EntityCentralIndexKey contextRef="P09_16_2026To09_16_2026" id="ixv-310">0001414932</dei:EntityCentralIndexKey>
    <dei:EntityAddressStateOrProvince contextRef="P09_16_2026To09_16_2026" id="hidden171754243">CA</dei:EntityAddressStateOrProvince>
    <dei:DocumentType contextRef="P09_16_2026To09_16_2026" id="ixv-323">8-K</dei:DocumentType>
    <dei:DocumentPeriodEndDate contextRef="P09_16_2026To09_16_2026" id="ixv-324">2026-09-16</dei:DocumentPeriodEndDate>
    <dei:EntityIncorporationStateCountryCode contextRef="P09_16_2026To09_16_2026" id="ixv-325">DE</dei:EntityIncorporationStateCountryCode>
    <dei:EntityFileNumber contextRef="P09_16_2026To09_16_2026" id="ixv-326">814-00755</dei:EntityFileNumber>
    <dei:EntityTaxIdentificationNumber contextRef="P09_16_2026To09_16_2026" id="ixv-327">26-1219283</dei:EntityTaxIdentificationNumber>
    <dei:EntityAddressAddressLine1 contextRef="P09_16_2026To09_16_2026" id="ixv-328">333 South Grand Avenue</dei:EntityAddressAddressLine1>
    <dei:EntityAddressAddressLine2 contextRef="P09_16_2026To09_16_2026" id="ixv-329">28th Floor</dei:EntityAddressAddressLine2>
    <dei:EntityAddressCityOrTown contextRef="P09_16_2026To09_16_2026" id="ixv-330">Los Angeles</dei:EntityAddressCityOrTown>
    <dei:EntityAddressPostalZipCode contextRef="P09_16_2026To09_16_2026" id="ixv-331">90071</dei:EntityAddressPostalZipCode>
    <dei:CityAreaCode contextRef="P09_16_2026To09_16_2026" id="ixv-332">(213)</dei:CityAreaCode>
    <dei:LocalPhoneNumber contextRef="P09_16_2026To09_16_2026" id="ixv-333">830-6300</dei:LocalPhoneNumber>
    <dei:WrittenCommunications contextRef="P09_16_2026To09_16_2026" id="ixv-334">false</dei:WrittenCommunications>
    <dei:SolicitingMaterial contextRef="P09_16_2026To09_16_2026" id="ixv-335">false</dei:SolicitingMaterial>
    <dei:PreCommencementTenderOffer contextRef="P09_16_2026To09_16_2026" id="ixv-336">false</dei:PreCommencementTenderOffer>
    <dei:PreCommencementIssuerTenderOffer contextRef="P09_16_2026To09_16_2026" id="ixv-337">false</dei:PreCommencementIssuerTenderOffer>
    <dei:Security12bTitle contextRef="P09_16_2026To09_16_2026" id="ixv-338">Common stock, par value $0.01 per share</dei:Security12bTitle>
    <dei:TradingSymbol contextRef="P09_16_2026To09_16_2026" id="ixv-339">OCSL</dei:TradingSymbol>
    <dei:SecurityExchangeName contextRef="P09_16_2026To09_16_2026" id="ixv-340">NASDAQ</dei:SecurityExchangeName>
    <dei:EntityEmergingGrowthCompany contextRef="P09_16_2026To09_16_2026" id="ixv-341">false</dei:EntityEmergingGrowthCompany>
    <cef:LongTermDebtTableTextBlock contextRef="P09_16_2026To09_16_2026" id="ixv-342">The Ninth Supplemental Indenture relates to the Company&#x2019;s issuance, offer and sale of $300.0&#160;million aggregate principal amount of its 7.000% Notes due 2031 (the &#x201c;Notes&#x201d;).</cef:LongTermDebtTableTextBlock>
    <cef:LongTermDebtPrincipal
      contextRef="P09_16_2026To09_16_2026"
      decimals="-5"
      id="ixv-343"
      unitRef="Unit_USD">300000000</cef:LongTermDebtPrincipal>
    <cef:LongTermDebtTitleTextBlock contextRef="P09_16_2026To09_16_2026" id="ixv-344">7.000% Notes due 2031</cef:LongTermDebtTitleTextBlock>
    <cef:LongTermDebtStructuringTextBlock contextRef="P09_16_2026To09_16_2026" id="ixv-345">The Notes mature on September&#160;16, 2031 (the &#x201c;Maturity Date&#x201d;), unless previously redeemed or repurchased in accordance with their terms. The Notes bear interest at a rate of 7.000% per year payable semiannually in arrears on March&#160;16 and September&#160;16 of each year, commencing on March&#160;16, 2027.Prior to August&#160;16, 2031 (one month prior to the maturity date of the Notes), or the Par Call Date, the Company may redeem the Notes at its option, in whole or in part, at any time and from time to time, at a redemption price (expressed as a percentage of principal amount and rounded to three decimal places) equal to the greater of: (1) (a) the sum of the present values of the remaining scheduled payments of principal and interest thereon discounted to the redemption date (assuming the Notes matured on the Par Call Date) on a semi-annual basis (assuming a &lt;div style="white-space:nowrap;display:inline;"&gt;360-day&lt;/div&gt; year consisting of twelve &lt;div style="white-space:nowrap;display:inline;"&gt;30-day&lt;/div&gt; months) at the Treasury Rate plus 40 basis points less (b)&#160;interest accrued to the date of redemption, and (2) 100% of the principal amount of the Notes to be redeemed, plus, in either case, accrued and unpaid interest thereon to the redemption date. On or after the Par Call Date, the Company may redeem the Notes, in whole or in part, at any time and from time to time, at a redemption price equal to 100% of the principal amount of the Notes being redeemed plus accrued and unpaid interest thereon to the redemption date. The Notes will not be subject to any sinking fund. In addition, if a Change of Control Repurchase Event (as defined in the Ninth Supplemental Indenture) occurs prior to maturity, unless the Company has exercised its right to redeem the Notes in full, holders will have the right, at their option, to require the Company to repurchase for cash some or all of the Notes at a repurchase price equal to 100% of the principal amount of the Notes being repurchased, plus accrued and unpaid interest to, but not including, the repurchase date.</cef:LongTermDebtStructuringTextBlock>
    <cef:LongTermDebtDividendsAndCovenantsTextBlock contextRef="P09_16_2026To09_16_2026" id="ixv-346">The Indenture, as supplemented by the Ninth Supplemental Indenture, contains certain covenants, including a covenant requiring the Company to comply with Section&#160;18(a)(1)(A) as modified by Section&#160;61(a)(1) and (2)&#160;of the Investment Company Act of 1940, as amended, or any successor provisions, but giving effect to any exemptive relief granted to the Company by the Securities and Exchange Commission (the &#x201c;SEC&#x201d;) and to provide financial information to the holders of the Notes and the Trustee if the Company should no longer be subject to the reporting requirements under the Securities Exchange Act of 1934, as amended. These covenants are subject to important limitations and exceptions that are set forth in the Indenture.</cef:LongTermDebtDividendsAndCovenantsTextBlock>
</xbrl>
