Remember when 2x4’s were actually 2”X 4”, likely not as the change occurred more than 100 years ago. Small regional lumber mills realized that availability of rail made selling their lumber outside traditional market could only occur through adoption of grade and dimensional standards.
As a DIYer or contractor it is important to understand how dimensional lumber sizes are determined, what grading stamps mean and the process that lumber is made to better understand the product your purchasing.
Utilization
It is economically viable and often regulated for lumber mills to use every bit of wood they can from the trees they harvest. Some forests are better suited to peeling, some to chipping and others for cutting into lumber, we will focus on the ones being cut into boards.
When logs are sawed into boards, they’re cut to rough dimensions equal to their full thickness and width, i.e. 2x4’s are cut to 2”X4” etc.
As boards are cut into 1” or 2” thickness it is often expressed in quarter inch increments with one inch referred to as 4/4 and two inch as 8/4. How many times have you heard of 5/4” common in deck boards.
Softwood lumber is usually cut in two inch wide intervals (4”, 6”, 8”, 10”, and 12”), and even lengths (8’, 10’, 12’, etc.). That is why we see the common sizes called 2X6-10’s as eg. on lumberyard shelves
Hardwoods are often cut into whatever width and length the log permits.

Green Days
Freshly cut lumber is called Green and as it dries shrinks in width and thickness until it reaches equilibrium with the air around it.
The moisture level inside a climate controlled house can vary from 5% to 13%, depending on where you live and the time of year. Softwood lumber is stamped at the mill to indicate how it has been dried, though the actual moisture content may differ if it has become wet or has been treated after it was marked.
Some of the common drying designations stamped on boards are:

The Process of Planning
After it has been dried, most softwood lumber is run through a planer where it is smoothed and cut to uniform width and thickness. Planed lumber is designated as S4S if it has been surfaced on all four sides or S2S if the edges are left rough. Since thicker wood shrinks more, one inch boards are planed to ¾” while two inch stock is reduced to 1½”. This is true of width as well, with ½” being taken off boards 4” to 6” wide, and ¾” removed from boards over 6” wide.
While it’s possible to buy unplaned lumber straight from the sawmill, it is called “rough” for a reason, since it can vary in size from one board to the next.
Hardwood lumber, however, is quite often sold rough, so that craftsman can plane boards to their own specifications.
Earning Grade
Lumber is graded based on how it will be used. The fewer knots and defects, the higher the grade and the more expensive it is. Since the price can often double from one grade to the next, it’s important not to buy a better grade of lumber than needed.
Softwoods
Grading for strength is different than grading for appearance. If you want both it is called #1 Select.
Lumber from cone bearing trees—like pine, spruce, redwood, and fir—are grouped together as softwoods and graded based on either their strength or appearance. Knots and other defects result in a lower grade. Most two inch thick softwood lumber is graded for its strength rather than appearance.
Common grades found at your lumberyard are:
Softwood lumber that is graded for appearance is used mainly for facing boards and other finish work. The highest quality appearance lumber is known as “finish” followed by “select.”

Each category is graded from best to worst as:
Some specialty softwoods—such as redwood and western cedar—are graded on the amount of rot resistant heartwood as well as defects.
The more common grades of redwood are:
Softwood lumber contains a stamp indicating the name or number of the mill where the lumber was processed, the species of wood, how it was dried, the grade it received, and the organization that certified the grading.
Some of the common species abbreviations found on softwoods are:
Hardwoods
Hardwoods—such as oak, cherry, walnut, and poplar—are graded based on the amount of clear material that can be obtained from the board. Since they are often sold rough, hardwoods are usually not stamped.
The grades from best to worst include:

Conclusion
Next time your comparing lumber prices from retailer to retailer, understand that there may be a difference in quality. Don’t just compare 2x4 to 2x4 but the grade both structural and appearance.