Exhibit 23.1 CONSENT OF INDEPENDENT AUDITORS The Board of Directors and Shareholders RLI Corp.: We consent to incorporation by reference in the registration statement on Form S-8 (No. 333-1637) and Form S-3 (No. 33-61788) of RLI Corp. of our reports dated January 21, 1997, relating to the consolidated balance sheets of RLI Corp. and subsidiaries as of December 31, 1996 and 1995, and the related consolidated statements of earnings, shareholders' equity, and cash flows for each of the years in the three-year period ended December 31, 1996, and all related schedules, which reports are incorporated by reference in, or appear in (with respect to the schedules), the 1996 annual report on Form 10-K of RLI Corp. KPMG Peat Marwick LLP Chicago, Illinois March 21, 1997 38