<?xml version="1.0" encoding="UTF-8"?><edgarSubmission xmlns="http://www.sec.gov/edgar/ownership" xmlns:ns2="http://www.sec.gov/edgar/common">
    <headerData>
        <submissionType>144</submissionType>
        <filerInfo>
            <filer>
                <filerCredentials>
                    <cik>0001330708</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>
                <ns2:street1>9025 North Lindbergh Drive</ns2:street1>
                <ns2:city>Peoria</ns2:city>
                <ns2:stateOrCountry>IL</ns2:stateOrCountry>
                <ns2:zipCode>61615</ns2:zipCode>
            </issuerAddress>
            <issuerContactPhone>309-692-1000</issuerContactPhone>
            <nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>MICHAEL ANGELINA</nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold>
            <relationshipsToIssuer>
                <relationshipToIssuer>Director</relationshipToIssuer>
            </relationshipsToIssuer>
        </issuerInfo>
        <securitiesInformation>
            <securitiesClassTitle>Common</securitiesClassTitle>
            <brokerOrMarketmakerDetails>
                <name>Morgan Stanley Smith Barney LLC Executive Financial Services</name>
                <address>
                    <ns2:street1>1 New York Plaza</ns2:street1>
                    <ns2:street2>38th Floor</ns2:street2>
                    <ns2:city>New York</ns2:city>
                    <ns2:stateOrCountry>NY</ns2:stateOrCountry>
                    <ns2:zipCode>10004</ns2:zipCode>
                </address>
            </brokerOrMarketmakerDetails>
            <noOfUnitsSold>1908</noOfUnitsSold>
            <aggregateMarketValue>272844.76</aggregateMarketValue>
            <noOfUnitsOutstanding>45625771</noOfUnitsOutstanding>
            <approxSaleDate>02/16/2024</approxSaleDate>
            <securitiesExchangeName>NYSE</securitiesExchangeName>
        </securitiesInformation>
        <securitiesToBeSold>
            <securitiesClassTitle>Common</securitiesClassTitle>
            <acquiredDate>05/06/2021</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>544</amountOfSecuritiesAcquired>
            <paymentDate>05/06/2021</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <securitiesToBeSold>
            <securitiesClassTitle>Common</securitiesClassTitle>
            <acquiredDate>05/04/2023</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>683</amountOfSecuritiesAcquired>
            <paymentDate>05/04/2023</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <securitiesToBeSold>
            <securitiesClassTitle>Common</securitiesClassTitle>
            <acquiredDate>05/05/2022</acquiredDate>
            <natureOfAcquisitionTransaction>Restricted Stock</natureOfAcquisitionTransaction>
            <nameOfPersonfromWhomAcquired>Issuer</nameOfPersonfromWhomAcquired>
            <isGiftTransaction>N</isGiftTransaction>
            <amountOfSecuritiesAcquired>681</amountOfSecuritiesAcquired>
            <paymentDate>05/05/2022</paymentDate>
            <natureOfPayment>Not Applicable</natureOfPayment>
        </securitiesToBeSold>
        <nothingToReportFlagOnSecuritiesSoldInPast3Months>Y</nothingToReportFlagOnSecuritiesSoldInPast3Months>
        <noticeSignature>
            <noticeDate>02/16/2024</noticeDate>
            <planAdoptionDates/>
            <signature>/s/ Michael Edward Angelina</signature>
        </noticeSignature>
    </formData>
</edgarSubmission>
[{"type": "144", "sequence": "1", "filename": "primary_doc.xml", "secsgml_size_bytes": 4386}]
144
0001330708
XXXXXXXX
LIVE
0000084246
RLI CORP.
001-09463
9025 North Lindbergh Drive
Peoria
IL
61615
309-692-1000
MICHAEL ANGELINA
Director
Common
Morgan Stanley Smith Barney LLC Executive Financial Services
1 New York Plaza
38th Floor
New York
NY
10004
1908
272844.76
45625771
02/16/2024
NYSE
Common
05/06/2021
Restricted Stock
Issuer
N
544
05/06/2021
Not Applicable
Common
05/04/2023
Restricted Stock
Issuer
N
683
05/04/2023
Not Applicable
Common
05/05/2022
Restricted Stock
Issuer
N
681
05/05/2022
Not Applicable
Y
02/16/2024
/s/ Michael Edward Angelina