content: <?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>0001227758</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>RESTREPO ROBERT P JR</nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>
        <relationshipsToIssuer>
          <relationshipToIssuer>Director</relationshipToIssuer>
        </relationshipsToIssuer>
      </issuerInfo>
      <securitiesInformation>
        <securitiesClassTitle>Common</securitiesClassTitle>
        <brokerOrMarketmakerDetails>
          <name>Fidelity Brokerage Services LLC</name>
          <address>
            <com:street1>245 Summer Street</com:street1>
            <com:city>Boston</com:city>
            <com:stateOrCountry>MA</com:stateOrCountry>
            <com:zipCode>02110</com:zipCode>
          </address>
        </brokerOrMarketmakerDetails>
        <noOfUnitsSold>2864</noOfUnitsSold>
        <aggregateMarketValue>210360.00</aggregateMarketValue>
        <noOfUnitsOutstanding>91764132</noOfUnitsOutstanding>
        <approxSaleDate>03/13/2025</approxSaleDate>
        <securitiesExchangeName>NYSE</securitiesExchangeName>
      </securitiesInformation>
      <securitiesToBeSold>
        <securitiesClassTitle>Common</securitiesClassTitle>
        <acquiredDate>05/04/2023</acquiredDate>
        <natureOfAcquisitionTransaction>Stock Award</natureOfAcquisitionTransaction>
        <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
        <isGiftTransaction>N</isGiftTransaction>
        <amountOfSecuritiesAcquired>1366</amountOfSecuritiesAcquired>
        <paymentDate>05/04/2023</paymentDate>
        <natureOfPayment>Compensation</natureOfPayment>
      </securitiesToBeSold>
      <securitiesToBeSold>
        <securitiesClassTitle>Common</securitiesClassTitle>
        <acquiredDate>05/02/2024</acquiredDate>
        <natureOfAcquisitionTransaction>Stock Award</natureOfAcquisitionTransaction>
        <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
        <isGiftTransaction>N</isGiftTransaction>
        <amountOfSecuritiesAcquired>1498</amountOfSecuritiesAcquired>
        <paymentDate>05/02/2024</paymentDate>
        <natureOfPayment>Compensation</natureOfPayment>
      </securitiesToBeSold>
      <nothingToReportFlagOnSecuritiesSoldInPast3Months>Y</nothingToReportFlagOnSecuritiesSoldInPast3Months>
      <noticeSignature>
        <noticeDate>03/13/2025</noticeDate>
        <signature>/s/ Heather Foxworth as a duly authorized representative of Fidelity Brokerage Services LLC, as attorney-in-fact for RESTREPO ROBERT P JR</signature>
      </noticeSignature>
    </formData>
  </edgarSubmission>
metadata_documents: [{"type": "144", "sequence": "1", "filename": "primary_doc.xml", "secsgml_size_bytes": 3341}]
text: 144
  0001227758
  XXXXXXXX
  LIVE
  0000084246
  RLI CORP
  001-09463
  9025 N. LINDBERGH DRIVE
  PEORIA
  IL
  61615
  3096921000
  RESTREPO ROBERT P JR
  Director
  Common
  Fidelity Brokerage Services LLC
  245 Summer Street
  Boston
  MA
  02110
  2864
  210360.00
  91764132
  03/13/2025
  NYSE
  Common
  05/04/2023
  Stock Award
  Issuer
  N
  1366
  05/04/2023
  Compensation
  Common
  05/02/2024
  Stock Award
  Issuer
  N
  1498
  05/02/2024
  Compensation
  Y
  03/13/2025
  /s/ Heather Foxworth as a duly authorized representative of Fidelity Brokerage Services LLC, as attorney-in-fact for RESTREPO ROBERT P JR