Updated: Oct 7, 2019
There's few subjects that seem to provoke as much confusion and misunderstanding as mastering - and this post is about shedding a little light on the subject.
Confusion seem to exist on what mastering does and is - especially with digital recordings. As a consequence, misunderstandings abound on how and if it makes sense to apply the step.
You find all sort of definitions: some plausible ("mastering corrects errors in your mix"), some quite off ("mastering is where you get the final sound of your track") and some nonsensical ("mastering is the last step of your mixing process".. ok, then why not calling it mixing?).
Having discussed this a gazillion times, I've found it useful to start with what mastering is not.
Mastering is not supposed to change the sound of your mix.
Yes, of course you can take your stereo mix and apply EQ and effects (just like was done at mixing) and change the sound. And it's not necessarily wrong: anything that gets you the sound you want is by definition right; it's just not mastering - in the sense that it's not a separate step that has a meaning and a function on its own and deserves a different name. When you take a stereo mix and change the sound deeply, you're simply mixing in another form.
So what is mastering?
Let's first consider a single song.
There's four aspects involved in (digital) mastering: the first three have little to do with the sound, and simply consist in removing the working headroom, reducing the word length and possibly sample rate, as necessary to convert your mix to CD format (16 bit, 44.1KHz).
The fourth aspect is making sure your song keeps its sonic character on any playback system: in other words it must feel the same from the mini speaker of your smartphone to the thundering power of a disco PA.
Let's have a look at each of them.
1) Working headroom elimination
When you mix modern digital recordings, you mix at 24 bit and your track levels will be around the middle off the full scale (if they aren't and your tracks are "in the yellow", read about how DAWs destroy recordings).
That way, your mix will always have a good dollop of working headroom over the song's maximum level, typically peaking at some -10 to -6 dBFS. Leaving this headroom on the master bus allows you to add more tracks/instruments, apply potentially gain-increasing processing like EQ and compression and so on - without worrying about horrible digital clipping.
However, this also means that when your mix is finished, it will still likely peak much lower than 0 or -1 dBFS, and it will need to be brought up (usually to somewhere near -1 dBFS, see "Master that stream!") to reach its final, commercial-release volume.
This aspect of mastering simply makes your mix louder - loud enough to be in line with most commercial productions out there.
2) Word length reduction
Your working format during mix will also likely be 24 bits or more - which allows better calculations when applying effects etc (see "Computers aren't good with numbers" if you are interested). This needs to be brought down to 16 bit, but the step of doing so is simply dithering, which is quite straightforward.
3) Sample rate conversion
Finally, you may have chosen to record and mix at higher sample rates than 44.1KHz. This may sometimes be worth doing, as it allows for slightly better processing in certain circumstances, where valuable high frequency information may be better preserved and handled (for example, cymbal hits in a recorded drum kit).
From this point of view, mastering means going down to 44.1KHz. This is done by downsampling, which essentially consists in reconstructing the waveform from the 24 bits samples, apply the anti-aliasing filter and resampling the result at the lower sample rate.
Incidentally, many software resamplers nowadays are excellent (even technically better than hardware), but not all are equal. Even the ones included in some DAWs may be a little worse than others.
Rather than giving a link which is easily outdated, I suggest you search for "software resampler comparison" and you will get to any information that exist on the subject at the moment of your reading.
All of the above means that if all is well with a mix, mastering consists only of the technical steps for removing the working headroom left over from mixing, downsampling and dithering to 16 bit - and you’re done.
Note that this is true specifically for digital audio mastering. Mastering to analog media (musicassette or vinyl) will require way more sound manipulation, simply to translate the studio mix into something that can "fit" the target media.
That's because from a sonic perspective, in digital audio, the target format (CD quality, that is 44.1KHz sampling rate, 16 bit sample word length) is just as good as the mixing format (44.1 or 96KHz sampling rate, 24 bit sample word length).
CD quality already can represent pretty much all the nuances that the human ear can distinguish. The 24 bits format is better only as a working format.
In other words, higher word length and sample rate allow more precise calculations during (software) mixing, but they make little sonic difference to the listening experience for a single file.
On the contrary, when mastering for analog targets, the target format has far lower capabilities than the media containing the studio mix.
The consequence is that special steps need to be taken to ensure that, for example, the mix low-end doesn't make the record player' stylus jump or the mix high end does not exceed the information-carrying capabilities of PVC grooves.
For long-playing vinyl records these latter also vary depending on the position of the song on the disc (so much for that hipster-loved vinyl sound quality!), and therefore mastering is also about pushing varying equalization, even while the lacquer is created, in order to to deal with that.
These steps were quite necessary also before digital recordings and mixing, since master tape as well had a much higher dynamic range and much more consistent frequency response than vinyl or musicassettes.
That means mastering for vinyl was a lot of work, and required great skills of the mastering engineer.
But in the digital word, mastering a single "perfect" mix is almost a mechanical operation.
4) Playability on different playback systems
However, a mix is seldom perfect.
What exactly does it mean "not perfect"?
Essentially it means that the mix, when reproduced across vastly different playback systems, does not keep the same sonic feel.
For example, the kick drum which sounds so heavy and nice on your monitors disappears when played on laptop speakers; the reverb that is so lovely and lush in the studio becomes a messy mush when played on a mono iphone speaker (or disappears entirely, leaving your track very dry); vocals which appear well balanced in your headphone stick out as a sore thumb on speakers; and so no.
Obviously it's not possible to keep the sonics identical across systems with vastly different capabilities (think of a mono or stereo system... but also the enormous differences between a band-limited phone speaker and a full range PA). The goal, however, is to keep the overall balance and feel of the track, as much as possible.
Mix "imperfections" are anything in the mix that prevents that.
Stuff like low end that exists only in the very low range, and cannot be reproduced in band-passed systems is an imperfection; highs that become screetchy when heard on a full-power PA are imperfections; resonances which are heard only when the playback volume is very high are imperfections; and so on.
Note that lots of this stuff can (and should) be fixed in the mix, but sometimes that isn't possible for practical reasons: the sonics of the mixing room or, simply, the budget for mixing is spent, the mixing engineer is no longer available, and so on.
And yes, obviously there's also plain and simple mixing mistakes (say, "too little bass")... but these are seldom, if ever, made by good mixing engineers. In these rare cases, a mastering engineer will notice the imperfections and do one of two things: either send the mix back to the mixing engineer with his notes; or, if that's impossible, try to fix things the best he or she can in the stereo mix.
It's also worth pointing out that certain common interventions belong to the master bus and can therefore be reasonably carried on over the bounced stereo file, instead of directly in the mixing project (for example, mono-izing the bass, creating certain types of stereo widening, or maybe add a hint of sizzling distortion to the proceedings).
Especially on heavy mixes, with dozens of tracks, it can be useful to save resources in the mixing project; and performing such interventions on the bounced file is just the same as performing them in the project's master bus.
But it's well worth repeating that, when possible, it is always better and easier to fix any imperfection in the mix: the secret for a great translating master is a great translating mix.
In any case: an imperfect mix is one that requires a little sonic manipulation to keep its sonic feel across as many playback systems as possible. The mastering engineer's tools in this case are EQs, exciters, multiband compressors and really anything that allow to slightly manipulate sections of the sound to make it more cross-compatible..
A side note. It's well worth noting that such "imperfections" have nothing to do with the sound you've chosen for the mix itself.
That is your artistic choice, and a mastering engineer will assume you know what you're doing and will try to preserve that choice as much as possible.
That's why is relatively pointless to ask a mastering engineer what he or she thinks about your sound. Most often they will either ignore the question or respond with some platitudes: they will certainly have an opinion (who doesn't) but they are aware that it's just that, and that your sound is your artistic choice. You, as a mixing engineer, decide the balance and the overall sound of the mix.
It's true that these days more and more mixes are submitted by mixing engineers who may be still less than accomplished, so that such questions can be more justified and understood... but a master engineer will usually err on the side of caution. Assuming that a mix sound is the result of the customer's incompetence can be bad for business!
All this said, there's more than the sonics to digital mastering:
cutting different versions (for example mp3s, but also CD-oriented masters peaking at 0dBFS vs. streaming-oriented versions peaking a little lower)
producing the data files required by CD factories to print in quantity,
and of course sequencing and imprinting a cohesive sound to a set of songs when mastering an album.
All these are importants part of mastering, but I find they are generally easier to understand, which is why I've focused on the sonic aspects.