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), Form S-8 (No. 333-28625) and Form S-3 (No. 33-61788) of RLI Corp. of our reports dated January 14, 1999, relating to the consolidated balance sheets of RLI Corp. and subsidiaries as of December 31, 1998 and 1997, 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, 1998, and all related schedules, which reports aaare incorporated by reference in, or appear in (with respect to the schedules), and 1998 annual report on Form 10-K of RLI Corp. KPMG, LLP Chicago, Illinois March 24, 1999