Four in a Row

Rubik’s cube solver

Solve any 3x3 cube in about 20 moves. Colour in your real cube, or scramble the 3D cube here, then press Solve. Watch the solution move by move on the 3D cube, with every turn explained in plain words.

Moves: 0

Scramble or turn the cube

Mix up the cube on screen (or turn it to match a position you have), then press Solve.

Scramble:

How to use the cube solver

  1. Hold your cube the right way. White centre on top, green centre facing you. That means red is on the right. (The centres never move compared with each other, so this always works.)
  2. Colour in the stickers. Choose Enter my cube’s colours, pick a colour and tap each sticker. Do the top, front and right first, then drag the background (or use the flat map) for the back, left and bottom.
  3. Fix any mistakes. The solver checks your colours as you go. If something is impossible it tells you what is wrong, for example too many reds or a corner that can’t exist.
  4. Press Solve. The first time, the solver takes a moment to get ready. After that, most cubes are solved in well under a second.
  5. Follow the moves. Press Next to do one turn at a time, or Play to watch them all. Each move is written in standard notation and in words, like “Turn the right face clockwise”.

Not sure what the letters mean? Read cube notation explained and how to read a solution. The short version: R means turn the right face clockwise (as you look at it), R’ means anticlockwise and R2 means half a turn.

Why the solver says a cube is impossible

If you took your cube apart, peeled stickers or got a colour wrong, the solver may spot a position that can’t be reached just by turning. It checks for:

Usually the cause is a single sticker entered wrongly, so check the pieces named in the message first.

How the solver works

This solver uses the two-phase method first described by Herbert Kociemba in 1992. Our version is written from scratch for this site and runs entirely in your browser. Nothing is sent to a server.

Phase 1 turns the cube until every piece is the right way up (as if it were an easier puzzle) and the four middle-layer edges are in the middle layer. From there the cube can be finished using only half turns of the sides plus any turns of the top and bottom. Phase 2 then solves it using just those moves. Big look-up tables built in a background worker tell the search which moves get closer, so it can try millions of options very quickly. It keeps looking for a shorter answer for a short time and usually ends up at about 19 to 21 moves.

The shortest possible solution for any position is never more than 20 moves. That fact is known as God’s number. A computer solution like this is perfect for checking a position, but it is hard to remember. To learn to solve a cube yourself, try the beginner’s method.

Rubik's Cube is a trade mark of Spin Master. This site is not affiliated with or endorsed by Spin Master.

Questions people ask

How many moves does the solver need?

Usually 19 to 21 moves. No position ever needs more than 20 moves for a perfect solver, and ours gets close to that in under a second on most devices.

Why does my cube say it can’t be solved?

One or more stickers are probably entered wrongly, or a piece has been twisted, flipped or swapped by hand. The message tells you which kind of problem it found.

Which way should I hold my cube?

White centre on top and green centre facing you. If your cube has different colours, hold it so the top and front centres match the map on screen.

Does the solver send my cube anywhere?

No. All the working out happens in your browser on your own device.

Can it solve a 2x2 or 4x4?

Not yet. This solver is for the 3x3 cube only.