From the start of the 17th century and through to the middle of the 19th, the Royal Navy used a rating system in order to categorise their ships. Initially, these ships were rated on their assigned complement (number of personnel onboard) and later this changed to factor in the number of carriage-mounted guns on board.
This concept of rating ships truly began under Henry VIII, though. His fleet was, at the time, made up of around 60 ships all separated by class: ships, galliasses, pinnaces and row barges. As we move forward through history to the Stuart period ships were then classed under different terms: Royal Ships (the largest), Great Ships, Middling Ships and Small Ships. These were rated in part using mostly tonnage. In 1626, Charles I had a table drawn up to cover the rating of ships in his fleet and the navy used this, though predominantly it covered the amount a seaman would be paid based on the size of ship he served on from "first" to "sixth" rate, however this changed again in around 1660, when it began to become related to the number of guns a ship carried.
In the late 1600s, Samuel Pepys, who was then serving Secretary to the Admiralty drew up this classification again. The number, weight and size of the guns would determine the complement of a ship as well as rations and pay required. He would rate ships indicating where they would stand in the line of battle (which is where you will have heard the phrase "ships of the line"). This changed a number of times until around the late 19th century, when the Navy moved away from this method, with the introduction of new technology, including steam power and armour, when the number of guns carried no longer mattered in the same way.
So what were the ratings for the British fleet at the time of Trafalgar?
At Trafalgar there were British ships of almost every size, so let's break it down and find out more about them!
First Rates
Your first rates were a follow on from the "Royal Ships" mentioned above and were ships of the line. By the early 18th century, it had become accepted that 100+ guns was the standard criterion for a first rate in wartime. They would usually be found heading up your line of battle. First Rates, such as HMS Victory, were three decked ships. In the sense that they had three gun decks (lower, middle and upper gun decks). As well as these guns, they usually had smaller guns on the forecastle, quarterdeck and poop deck. For example, after the invention of the slide mounted carronade in the 1770s, first rates could mount these on their quarterdecks and forecastles to assist in short-range firepower, but they were not included in the ship's rating until 1817.
First rates were also extremely expensive to operate and many were predominantly only used as commanding Admirals' flagships, being taken out "of ordinary (commission)" in times of war. Spending time in ordinary meant many of these first rates had a vast lifespan in comparison. HMS Victory had been in service for 40 years by the time of Trafalgar, many of these years being spent in ordinary.
Second-Rates
A second-rate was a ship of the line, usually carrying 90 to 98 guns on three gun decks; earlier 17th century second rates had fewer guns and often only two decks. The second-rates were also found fighting in the line of battle, but often served overseas as flagships as well, as they were less valuable to send to the far side of the world! The three decked second rate, predominantly only used by the British, was not the best ship, however. Not very fast, certainly not very manoeuvrable and tended to drift to leeward (left/port). Due to this HMS Prince and HMS Dreadnought were ordered by Nelson at Trafalgar to approach the Combined Fleet at a shorter angle than the rest of the column, with the idea that with more sail exposed to wind they could actually keep up with the fleet.
Third Rates
Third-rates were also found fighting in the line of battle, but were swifter, far more manoeuvrable, better to handle and cheaper to run. The perfect ship, some might say. Horatio Nelson's favourite ship was, of course, HMS Agamemnon (a third-rate). From the 1720s a third rate generally mounted between 64 and 80 guns across two gun decks. By the turn of the century, a third rate was defined as carrying 60 guns or more.
Fourth Rates
Fourth-rates, carrying usually 46-60 guns, were mostly used during the first half of the 18th century. Despite some referring to them as ships of the line, in general they were not found in a line of battle unless they were the older variation with 60+ guns. After 1756 ships of below 50 guns were considered too weak to stand in the line. The 50 gun fourth rates were used as convoy escorts and on foreign stations where higher rated ships did not tend to group. They were used extensively throughout the Seven Years' War and American Revolutionary War, however, as they were well suited to fighting in shallow waters. A few were still in service by the Napoleonic Wars, incliding HMS Leander, which served at the Nile with Horatio Nelson.
Fifth Rates
Desite not being rated as ships of the line to stand in battle, fifth rates often found themselves involved during the Anglo Dutch Wars. These two decked ships had a gundeck on the lower, but fewer guns on the upper gun deck. Generally by the start of the 18th century, these fifth rates carried around 40 guns. They continued to be used into the American Revolutionary War and in later years a new fifth rate was built, the frigate! These had no gun ports on the lower deck and around 26-30 guns on the upper, with smaller guns mounted on the quarterdeck and forecastle. These served as scouts or independent cruising vessels. Fifth rates were often assigned to intercept enemy shipping, offering the prospect of good prize money. Frigates were not only manoeuvrable but deadly.
Sixth Rates
Sixth-rate ships were generally useful as escorts, or on blockade duty, as well as for the carrying of dispatches. The larger category of sixth-rate frigates carried around 28 guns. The sixth rate "post ships" usually carried 20 - 24. The sixth rates were often grouped with frigates, but were obviously too small.
Unrated Ships
Anything smaller than a sixth rate was not rated. Predominantly these would be the ships commonly referred to as "sloops", "brigs", or "corvettes" for example. The breakdown in confusion of those terms is one for another day! During the Napoleonic Wars, the Royal Navy increased the number of sloops in service as it needed vast numbers of these small vessels for escorting convoys, stopping privateers, and taking prizes.
Of course this is not definitive, and as mentioned there were around 6-7 changes of ship classification over a relatively short time period, but hopefully this will give you some idea of what these ships were getting up to at the time!