I have a fluorescent fixture which takes tubes. The fluorescent ballast has gone bad, or I want to upgrade to the latest. How do I select the correct ballast for my fixture?
You identify the tube type, then the ballast.
The fixture decides the tube
The fixture and its lampholders are going to decide the size of tube you can use. Within that, you may have some flexibility.
Start by looking at the fixture. Look at the length and shape of tube, and the lampholder sockets. Often, it's totally obvious, like the ubiquitous 48" T12 or T8 bi-pin linear tubes. Or is it? That "48" tube could actually be a 46" T5 tube, and I've even seen 2'x4' ceiling troffers with U-shaped bulbs in them.
You still have some options. For instance, most fixtures using linear T12 tubes will also fit linear T8 tubes, and vice versa -- and there will often be LED "tubes" also available in those sizes. There are even lampholders for T12/T8 fixtures with extensions to fit the shorter T5 tubes.
1-pin vs. 2-pin tubes. In over-4-foot tubes, look closely at the ends. Some have a single pin (a "nub") on each end of the tube. Others have a plastic molding with 2 pins. The latter are "high-output" (HO) or "very high-output" (VHO) and they require different ballasts.
T12 vs T8. The old T12 tube (1.5" diameter) is obsolete. Most T12 sizes have a T8 (1" diameter) equivalent which will snap right in, but is not electrically compatible. You need to use a T8 ballast. T8's are smaller, more efficient and produce more light - often three T8s can replace four T12s. (or you can just use four T8s and have more light.)
T5. T5 is yet thinner at 5/8". It hasn't really caught on in the US, and the fixtures and bulbs are costly. Selection is limited. They are not pin compatible and are shorter. That is why T5 conversion lampholders for 4-foot fixtures have an extension on them.
LED replacement "tubes". These are typically the shape of a linear T8 fluorescent tube, and will snap into T8 or T12 fixtures. They have fewer lumens, but they only light up one side of the tube. The light comes out perpendicular to the pins, which works great in most fixtures but could be a problem in some. LED emitters are very durable; the weak link is the electronic power supplies, especially on cheap units, which may not even last as long as a fluorescent tube!
Oddball tube sizes or sockets. Some tube sizes give you only limited choice of tube.
Color temperature These days, you can get fluorescent tubes or LEDs in any color temperature you want, including black. From 3000k halogen to 6500k blue daylight. Traditional fluorescent colors are 4100K.
Color Rendering Index (CRI) This indicates how realistic the light looks to the human eye. A better CRI is a breath of fresh air. Older fluorescents are 75 CRI or worse. Today, 80 CRI is mandated (higher for T12s) and 90 CRI tubes are readily available for $2.50/tube. Even 98 CRI can be had. LEDs aren't near these numbers, at least not at consumer friendly prices.
The tube decides the ballast
Once you know the tube you are using, you must find a ballast which is listed to drive that type, length and wattage of tube. Beyond that, you may have freedom to make some choices. First, ballast type has a lot to do with lamp performance and how long they'll last. Most wear on a fluorescent light is from how it is started.
Magnetic ballasts are obsolete, and you will not see them except for odd-size, specialty or HID lighting (mercury vapor etc.) in which case you're stuck with them. These buzz, flicker in cold, and flicker all the time for some people. I'll assume you'd rather have a modern electronic ballast which will be silent, work in cold, and not flicker.
Instant-start ballasts connect 1 wire to each end of the tube. Some sizes only have 1 pin, and are built extra-stout to endure the rough starts of an instant-start ballast. 2-pin tubes, not so much.
Rapid-start ballasts have a fixed "start sequence" where they preheat the filaments in each end of the tube. (that's why each end has 2 pins, and 2 wires going to each end of the tube). They take a second to start, but are much easier on the tubes.
Programmed-start ballasts have sensors to preheat the tube until it's actually ready to start. This varies by conditions, so they can take several seconds to start in the icy cold, for instance. They are easiest on the tube.
LED replacement tubes: "Plug-n-Play" are designed to work with an old fluorescent ballast in place. The sales pitch is to "save you the trouble" of removing the old ballast, just one problem: among the above types of ballast, they need a specific one. So you could have to add a ballast and worse, maintain that ballast forever. Terrible!
LED replacement tubes: "Direct Wire" types require you to bypass/remove the ballast, and wire 120V supply power directly to the lampholders. If you have the chops to change a ballast, you can handle this. Some LED tubes want 120V on the opposite ends of the tube. Others want it on the 2 pins at one end of the tube, in which case watch out for "shorting lampholders". More below.
The all-important ballast data sheet will tell you exactly what combinations of tubes the ballast can drive. Many can drive several sizes. What's more, some ballasts are able to drive 1 or 2 bulbs; if a bulb is absent, they still work fine. All of this is in the data sheet, along with other stuff.
Ballast factor indicates how strong the ballasts drives the tubes. A ballast factor of 1.00 means "normal" brightness for that tube type. They can overdrive to 1.10, or underdrive at 0.90, 0.74 or even lower. When a professional designs facility lighting, he will "spec" ballast factor as part of the overall lighting plan.
Power factor describes how unevenly the ballast draws power from the line. 90+% is good. Don't use much lower than that; a poor power factor requires the wire to carry more current, even though the light doesn't use it. For instance a 100W light with a 25% power factor, needs wiring for 400W of power draw, so only 3 of those on a 1440W circuit instead of 14.
Instant-Start ballasts vs. other kinds
Instant-start ballasts are wired very differently. This requires some adjustment, notably in the lampholders.
Instant into a fixture wired for magnetic/rapid/programmed. In this case, you'll find 2 wires coming from each end of each lamp. Typically one pair of those wires is common to all lamps (usually yellow). You simply join the 2 wires to the single wire coming from the ballast.
Rapid/programmed/LED into a fixture wired for instant-start The rapid or programmed ballasts (or some direct-wire LEDs) need 2 wires to each end of the tube. The fixture, wired for an instant-start ballast, will have only one. The wires cannot be joined; both these wires will need to go to the lampholders. The problem is, they are likely to be shorting lampholders.
Shorting lampholders. Most tubes have 2 pins, so the lampholders have 2 pins. But instant-start ballasts use only one, and want them wired together. Fixtures built for instant-start ballasts often use an ugly beast called a "shorting lampholder", which shorts the two pins together internally. Watch out for these, they often have an "S" stamped on them, or only 2 holes when you'd expect 4. They won't work with rapid, magnetic, programmed or most direct-wire LEDs. Lampholders are mostly standard (mostly!) and you can buy common replacements online or from the big-box for under a buck each.
Ballasts are generally standard sizes. Sometimes the old ballast will be shorter or longer. But usually, the fixture is set up to take the other size of ballast, by using a different mounting slot, or moving the mounting screw.
Don't be spooked by the complexity. It can be a rats nest of wires. Hook up the "common" end of the lampholders first; then hook up the other end of each individual bulb; and lastly connect the AC power (black/white). Remember to unplug, or if not unpluggable, add a disconnect as described below.
Save extra length. The internal wiring is special. It's 18 AWG, but it's not thermostat wire -- it is insulated for 600V due to the high voltage of fluorescent lamps. It's tough to find this wire, and when you do, it's expensive. As such, I'm not in a hurry to trim back excess length - I can't get replacement wire!
Wire nuts for the typically 18 AWG wire inside a fluorescent fixture should be appropriate to the size -- I use the "blue" size, and it's good to tie 14-18 AWG or up to four 18's together.
Longer power cord, now's the time. Some fluorescent fixtures have six INCH cords (15cm). I buy 10 foot (3m) cords from McMaster-Carr for $4 each and retrofit. Always use 3-prong plugs; many ballasts need ground.
Hardwired fixtures? Disconnect plugs! The US National Electrical Code now requires that when you service a hard-wired fluorescent fixture, you also add a disconnect plug on the power supply line. This just hangs loose in the wiring. Turn the power off when doing this! But you don't have to do everything else in the dark: once the disconnect is fitted, you can turn power back on. That being the point.
Pull chain? Put a disconnect on it! When I pull ballast covers, they often dangle by the wires to a pull switch. I put a ballast disconnect on those, specifically the orange Ideal type, which will freely disconnect if you drop it. Now it won't tear wires out!
If a wall-switched fixture has a pull-chain and 2 ballasts, put the pull chain on only one ballast. Then you can switch it high and low.
Generally I use the Universal Lighting Technologies spec finder.
If you have the Universal (Universal is a brand of 3rd party replacement ballasts) number you can usually use it to cross reference back to OEM ballasts if the OEM number is unknown.
Another good method is to simply type the old ballast number into a Google search box by itself. The Amazon search box also will yield good information even if you intend to order from a local supply house, and not order from Amazon.
I probably order an odd-ball ballast once a week for a customer, I probably order more standard ballasts for customers several times a week. With the two methods I mentioned above. I rarely get stumped or can't find it, with some combination of those 3 searches.
Part of the decision process now should include updating to LED, Universals tools can help there as well.
It depends on the update you seek. As mentioned in other answers, LED is at a point where it makes a lot of sense. I prefer LED fixtures over LED replacement bulbs when I have a choice - it removes some of the compromises that are made to make an LED light fit into the form-factor of an older bulb type.
For actual florescent tubes, an easy swap is T12 to T8 - the standard lamps are mostly the same lengths (unless you have an oddball, and then you have to hunt) and the pin fittings are the same, so you just need to choose a new ballast that works for your fixture (length/new wattage of tubes and number of tubes). If your fixture is old enough to have a "starter" you will follow the wiring digram in the new ballast and probably not use that. But T8 is not "the latest..."
Going to T5 as a bulb/ballast replacement is harder, since the tube lengths and pins don't match up, but weird converter/extended devices are made. Always pay attention to the question of whether you are spending more to convert than you'd spend to replace the fixture, though.
I would replace the fixture with the latest LED tube technology. For less than three times the cost of a replacement ballast you can have a flicker free, silent, instant on, ballast-less light with superior spectrum and light output.