Optimal solutions for the Rubik's Cube are solutions that are the shortest in some sense. There are two common ways to measure the length of a solution. The first is to count the number of quarter turns. The second is to count the number of outer-layer twists, called "face turns". A move to turn an outer layer two quarter (90°) turns in the same direction would be counted as two moves in the quarter turn metric (QTM), but as one turn in the face metric (FTM, or HTM "Half Turn Metric", or OBTM "Outer Block Turn Metric").

The maximal number of face turns needed to solve any instance of the Rubik's Cube is 20, and the maximal number of quarter turns is 26. These numbers are also the diameters of the corresponding Cayley graphs of the Rubik's Cube group. In STM (slice turn metric), the minimal number of turns is unknown.

Optimal solutions for the Rubik's Cube

There are many algorithms to solve scrambled Rubik's Cubes. An algorithm that solves a cube in the minimum number of moves is known as God's algorithm.

Optimal solutions for the Rubik's Cube

Move notation

To denote a sequence of moves on the 3×3×3 Rubik's Cube, this article uses "Singmaster notation", which was developed by David Singmaster.

Optimal solutions for the Rubik's Cube

The followings are standard moves, which do not move centre cubies of any face to another location:

The letters L, R, F, B, U, and D indicate a clockwise quarter turn of the left, right, front, back, up, and down face respectively. Half turns are indicated by appending a 2. A counterclockwise quarter turn is indicated by appending a prime symbol ( ′ ).

However, because these notations are human-oriented, we use clockwise as positive, and not mathematically-oriented, which is counterclockwise as positive.

The following are non-standard moves, which move centre cubies of faces to other locations:

The letters M, S and E are used to denote the turning of a middle layer. M represents turning the layer between the R and L faces 1 quarter turn top to bottom. S represents turning the layer between the F and B faces 1 quarter turn clockwise, as seen from the front. E represents turning the layer between the U and D faces 1 quarter turn left to right, clockwise as seen from the bottom. As with regular turns, a 2 signifies a double turn and a prime (') indicates a quarter turn anticlockwise.

However, the M, S and E positive rotation directions are lousily defined. In a commonly oriented cube, the R, F and U faces are visible. However, M (meaning Middle) and E (meaning Equator) positive rotations follow the positive directions of invisible faces L and B respectively. But the S (meaning Side) positive rotation follows the positive direction of visible face F.

Instead, lowercase letters r, f and u are also used to denote turning layers next to R, F and U respectively in the same direction as R, F and U. This is more understandable.

The followings are cube moves, which rotate the whole cube:

The letters X, Y and Z are used to signify cube rotations. X signifies rotating the cube in the R direction. Y signifies the rotation of the cube in the U direction. Z signifies the rotation of the cube on the F direction . These cube rotations are used in algorithms to make the algorithms smoother and faster. As with regular turns, a 2 signifies a half rotation and a prime (') (please unify the symbol used for prime with its previous occurrence) indicates a quarter rotation in the opposite direction. Note that these letters are usually lowercase instead.

Because there are also non-standard moves, lowercase letters are used.

Lower bounds

It can be proven by counting arguments that there exist positions needing at least 18 moves to solve. To show this, first count the number of cube positions that exist in total, then count the number of positions achievable using at most 17 moves starting from a solved cube. It turns out that the latter number is smaller.