I regularly encounter people who don’t know whether a connection between two components is analogue or digital, let alone the differences between them, so I thought I’d write up a quick guide. 
 ​
 
Click on the picture for a larger version.​
 ​
A connection is either analogue or digital, not both. Different analogue connections can be connected with an adaptor cable, but different digital connections cannot. You cannot use a cable to connect a digital socket to an analogue input. That requires a DAC (Digital to Analogue Converter).
 
Confusingly, some 3.5mm (1/8") analogue headphone sockets also have an optical digital transmitter built in. When a 3.5mm (1/8") headphone plug is connected, they are analogue. When a mini-optical cable is connected they are digital.
 

Analogue

3.5mm (1/8”) TRS

6.5mm (1/4”) TRS

These are the same plugs and sockets your headphones and IEMs use, because they carry the same signal.  TRS stands for “tip, ring, sleeve”. The tip carries the left signal, the middle ring the right, and the bottom and sleeve are the combined ground and signal return.
 

RCA — “Single-ended"

This is the most common plug for connecting hi-fi components. Left and right each have their own plug, where the centre pin is the positive and the outside shell is the negative and ground. The difference between RCA and TRS is just that the plugs are different, so you can buy an adaptor cable to go from one to the other.
 

XLR — “Balanced"

Like RCA, left and right each have their own plug. The difference is that the ground is separate from the signal return, which is a mirror-image signal of the positive. It is most commonly used for long cable runs in pro audio as this set-up cancels out noise. It is also popular in high-end audio as many components use differential (balanced) topologies to cancel out noise and/or lower crosstalk between channels, depending on the intent of the designer.
 

Others

Some manufacturers use a TRRS plug with 4 connectors, either a 2.5mm or 3.5mm to carry a balanced signal, but without a ground. 
Sony is also promoting the new Pentaconn 4.4mm TRRRS plug that can be used for single-ended or balanced connections.
 

Digital

If you are connecting devices using a digital connection, the device that receives the connection and outputs music to your headphones is doing the digital to analogue conversion. The transmission will be usually in the PCM format. A digital connection doesn't send an MP3, FLAC, AAC or ALAC file, but it is converted (decoded) to PCM first and sent using a specific method of digital audio transmission, usually either USB or S/PDIF*.
 

AES/EBU

A balanced version of S/PDIF that uses a 3-pin XLR plug, similar to analogue XLR, but carrying a digital signal instead. It requires a 110 Ohm cable to be used to prevent issues.
 

Bluetooth

Most computers and phones now support APTX audio transmission, which gives almost CD quality over wireless. Sony also has a high-res Bluetooth audio transmission system and others are in development.
 

S/PDIF

Sony/Phillips Digital Interface. The most common digital connection available other than USB. Technically, it should use 75 Ohm coaxial BNC-terminated cables, but for convenience most manufacturers use RCA sockets and cables which confusingly look similar to the RCA cables used for analogue connections, even if they do use 75 Ohm cable. 
 
Optical
This has become the standard optical transmission method of S/PDIF. The almost square-shaped plug and socket is known as Toslink (Toshiba Link), and the 3.5mm plug is known as mini-optical. Some headphone sockets, such as on Apple's computers and Astell&Kern DAPs, have a headphone socket that is also a mini-optical port.
 

USB

USB digital audio has a specific transmission standard that is different to how digital data is transmitted to and from regular computer components.
 

Lightning

Apple's iPhone and iPad connector can transmit a digital audio signal, most often via the CCK (Camera Connection Kit) adaptor. The old 30-pin adaptor had connections for both digital and analog.
 
*Note: As this is a basic guide, I haven't mentioned DSD.