<?xml version="1.0" encoding="UTF-8"?><edgarSubmission xmlns="http://www.sec.gov/edgar/ownership" xmlns:com="http://www.sec.gov/edgar/common">
  <headerData>
    <submissionType>144</submissionType>
    <filerInfo>
      <filer>
        <filerCredentials>
          <cik>0001192707</cik>
          <ccc>XXXXXXXX</ccc>
        </filerCredentials>
      </filer>
      <liveTestFlag>LIVE</liveTestFlag>



    </filerInfo>
  </headerData>
  <formData>
    <issuerInfo>
      <issuerCik>0000084246</issuerCik>
      <issuerName>RLI CORP</issuerName>
      <secFileNumber>001-09463</secFileNumber>
      <issuerAddress>
        <com:street1>9025 N. LINDBERGH DRIVE</com:street1>
        <com:city>PEORIA</com:city>
        <com:stateOrCountry>IL</com:stateOrCountry>
        <com:zipCode>61615</com:zipCode>
      </issuerAddress>
      <issuerContactPhone>3096921000</issuerContactPhone>
      <nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>STONE MICHAEL J</nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>
      <relationshipsToIssuer>
        <relationshipToIssuer>Officer</relationshipToIssuer>
      </relationshipsToIssuer>
    </issuerInfo>
    <securitiesInformation>
      <securitiesClassTitle>Common</securitiesClassTitle>
      <brokerOrMarketmakerDetails>
        <name>Charles Schwab &amp; Co</name>
        <address>
          <com:street1>3000 Schwab Way</com:street1>
          <com:city>Westlake</com:city>
          <com:stateOrCountry>TX</com:stateOrCountry>
          <com:zipCode>76262</com:zipCode>
        </address>
      </brokerOrMarketmakerDetails>
      <noOfUnitsSold>4239</noOfUnitsSold>
      <aggregateMarketValue>620335.00</aggregateMarketValue>
      <noOfUnitsOutstanding>45554696</noOfUnitsOutstanding>
      <approxSaleDate>04/24/2023</approxSaleDate>
      <securitiesExchangeName>NYSE</securitiesExchangeName>
    </securitiesInformation>
    <securitiesToBeSold>
      <securitiesClassTitle>Common</securitiesClassTitle>
      <acquiredDate>12/01/2012</acquiredDate>
      <natureOfAcquisitionTransaction>Stock Option Exercises</natureOfAcquisitionTransaction>
      <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
      <isGiftTransaction>N</isGiftTransaction>
      <amountOfSecuritiesAcquired>4239</amountOfSecuritiesAcquired>
      <paymentDate>12/01/2012</paymentDate>
      <natureOfPayment>Cash Payment</natureOfPayment>
    </securitiesToBeSold>
    <nothingToReportFlagOnSecuritiesSoldInPast3Months>Y</nothingToReportFlagOnSecuritiesSoldInPast3Months>
    <remarks>Acquisition via stock
 option exercises starting 12/1/2012 to 2/28/2016.</remarks>
    <noticeSignature>
      <noticeDate>04/24/2023</noticeDate>
      <signature>Michael Stone</signature>
    </noticeSignature>
  </formData>
</edgarSubmission>
[{"type": "144", "sequence": "1", "filename": "primary_doc.xml", "secsgml_size_bytes": 2786}]
144
0001192707
XXXXXXXX
LIVE
0000084246
RLI CORP
001-09463
9025 N. LINDBERGH DRIVE
PEORIA
IL
61615
3096921000
STONE MICHAEL J
Officer
Common
Charles Schwab & Co
3000 Schwab Way
Westlake
TX
76262
4239
620335.00
45554696
04/24/2023
NYSE
Common
12/01/2012
Stock Option Exercises
Issuer
N
4239
12/01/2012
Cash Payment
Y
Acquisition via stock
 option exercises starting 12/1/2012 to 2/28/2016.
04/24/2023
Michael Stone