Connecting end caps, or wire nuts as they are called in the industry, is one of the safest ways to terminate an electrical wire or tie two or more wires together. Wire nuts come in different sizes and have various colours which designate the gauge of wire and the number of wires that can be tied together. There is no standard colour code, as each manufacturer has their own colour designations. Generally, a yellow end cap is used for tieing two or three 12-gauge wires together, and a red cap for more than three. The packaging will give specific recommendations for use of the particular end caps.
Turn off any power (such as with a circuit breaker) or unplug any cords that might be supply electricity to the wires to be worked on.
Cut the wires to the desired length. Strip back the outer covering if necessary to expose the inner wires. Strip off one inch of insulation on the end of each wire.
Line up the ends of each of the wires until they are even, and twist them together in a clockwise direction.
Slide a wire nut/end cap onto the end of the twisted wires and twist the cap in a clockwise direction to tighten the nut on the end of the wire.
Wrap the end of the wire with the nut on with electrical tape to further insulate the connection. Leave about a half inch of the cap showing so you can see what colour it is to reference the wires for later access.
Match the colour of the end cap/wire nut with the purpose of the wire. Example: use a red nut/cap for wires that are considered "hot" or carry electricity, a white nut/cap for a neutral wire.
Never attempt to work on any electrical wire that has electricity running to it without turning it off; as this could result in serious injury or electrocution.