The size of lumber to use for mounting rails for shelves and cabinets can vary depending on several factors, including the weight-bearing capacity required and the specific design of the shelves or cabinets. However, a commonly used size for mounting rails is 1x2 or 1x3 lumber (actual dimensions of 3/4" x 1 1/2" or 3/4" x 2 1/2" respectively).
Using 1x2 or 1x3 lumber as mounting rails provides sufficient strength and stability for most applications. These sizes are often suitable for supporting typical shelf loads and securing cabinets to walls. However, if you anticipate heavier loads or larger cabinets, you may want to consider using larger or thicker lumber, such as 2x2 or 2x3 boards (actual dimensions of 1 1/2" x 1 1/2" or 1 1/2" x 2 1/2" respectively), to ensure adequate support.
Remember to assess the specific requirements of your project, including the weight of the items to be placed on the shelves or cabinets, and consider consulting a structural engineer or a knowledgeable professional if you have concerns about load-bearing capacity. Additionally, local building codes and regulations may dictate specific requirements for shelf or cabinet mounting rails, so it's advisable to check those as well before proceeding with your installation.