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) of RLI Corp. of our reports dated January 21, 1998, relating to the consolidated balance sheets of RLI Corp. and subsidiaries as of December 31, 1997 and 1996, and the related consolidated statements of earnings and comprehensive earnings, shareholders' equity, and cash flows for each of the years in the three-year period ended December 31, 1997, and all related schedules, which reports are incorporated by reference in, or appear in (with respect to the schedules), the 1997 annual report on Form 10-K of RLI Corp. KPMG Peat Marwick LLP Chicago, Illinois March 20, 1998 36