Solve a real cube, not just a simulated one
Hold your cube up to the camera, show it all six sides, and this works out the moves that solve it. Everything happens inside this page — reading the colours, searching for the solution, playing it back in 3D. Nothing is uploaded, nothing is installed.
Want to solve it yourself?
This page will solve any cube for you, but following a solution is not the same as knowing how it works. There is a step-by-step beginner’s course here too — the pieces, the notation, and the six steps, with every algorithm playable on this cube.
Every control, in one place
Watching a solution
| To do this | Do that |
|---|---|
| Scramble | Press Scramble, or type your own in the box and press Apply |
| Solve | Press Solve. A scramble is solved for you automatically on arrival |
| Play | The amber play button, or the space bar |
| One move at a time | The step buttons, or the left and right arrow keys |
| Jump anywhere | Drag the slider, click any move in the solution list, or press Home / End |
| Change the speed | The Speed slider beside the transport |
| Start again | Reset puts a solved cube back on the table |
Turning and looking
| To do this | Do that |
|---|---|
| Turn one layer | Drag a sticker with the mouse or one finger. The layer follows the direction you pull |
| Turn a named face | The notation buttons under Turn it yourself, or the keys u r f d l b — hold shift for an anticlockwise turn |
| Look at the other sides | Drag the background, use two fingers anywhere, or right-drag with a mouse |
| Zoom in and out | Pinch on a touch screen, or the mouse wheel. Double-click to go back to the default size |
Dragging a middle layer does nothing, on purpose: this solver works in whole face turns, so there is no move it could give you for the slice between two faces.
How to use it
- Press “Scan a real cube with the camera” and allow the camera when the browser asks.
- Follow the six movements. You are never asked to name a face. Point any side at the camera to start, turn the cube a quarter to the left three times, then tip it twice. Each movement is drawn on screen.
- Check the colours. Anything the reader was unsure about is ringed; click a sticker to change it. The cube is checked for solvability before it is accepted.
- Watch it solve. Press play, or step through a move at a time with the arrow keys.
- Copy the moves onto your cube. Turn your cube so it matches the one on screen first — you chose the starting orientation when you scanned, so the moves are written for that way round.
No cube to hand? Press Scramble and watch it solve that instead, or type your own scramble in standard notation.
Move notation
Each letter is a quarter turn of one face, clockwise as you look at that face from outside the cube.
| Move | Means |
|---|---|
| U | Turn the up face a quarter clockwise |
| D | Turn the down face a quarter clockwise |
| R | Turn the right face a quarter clockwise |
| L | Turn the left face a quarter clockwise |
| F | Turn the front face a quarter clockwise |
| B | Turn the back face a quarter clockwise |
| R′ | The same turn anticlockwise; any letter takes a prime |
| R2 | A half turn, where direction does not matter |
So R U R′ U′ is four quarter turns. Repeat it six times on
a solved cube and the cube returns to solved — a quick way to check you
are reading the notation the same way this page writes it.
How the solver works
A cube has about 43 quintillion positions, so searching them one at a time is hopeless. This uses Herbert Kociemba’s two-phase algorithm, which splits the problem in half.
Phase 1 drives the cube into the subgroup
<U, D, R2, L2, F2, B2>: corners untwisted, edges unflipped, and
the four middle-layer edges back in the middle layer. That never takes more
than 12 moves. Phase 2 finishes the cube using only those
restricted turns, in at most 18 more.
Both phases are IDA* searches, each guided by two pruning tables that give the minimum number of moves still needed, so hopeless branches are cut at once. The tables are built in your browser the first time the page loads, in roughly a third of a second.
The first answer found is not the end: a longer phase 1 often allows a much shorter phase 2, so the search keeps going and reports the best total it found. Every position can be solved in 20 moves or fewer — God’s number — and this usually lands on 20 or 21.
How the colours are read
Nothing is compared against a fixed table of colours, because a red sticker under a warm lamp reads much like an orange sticker under a cool one. Instead the six colours and the light each side was photographed under are worked out from the 54 samples themselves.
Two facts make that solvable: a cube has exactly nine stickers of each colour, and the centre sticker of a side is that side’s colour, which anchors every capture. In even room light this read all 54 stickers correctly in every test; in harsh, uneven light it is right about three times in four, and nearly every remaining case is caught because the result is not a solvable cube.
Questions
Does it work on a phone?
Yes. The rear camera is used where there is one, and the layout stacks on a narrow screen.
It says my cube cannot be solved. What went wrong?
Almost always a misread sticker. The message names the rule that was broken: a single flipped edge, a single twisted corner, or two pieces swapped. None of those can happen on a cube that was only ever turned, so correct the ringed stickers or scan again in flatter light. It can also mean the cube was taken apart and reassembled wrongly.
Is 20 moves guaranteed?
No. Every position can be solved in 20, but finding that shortest answer can take minutes. Two-phase gets within a move or two of it in well under a second, which is the better trade for a page you are waiting on.
Are my camera images sent anywhere?
No. The video never leaves the page. Only nine averaged colours per side are kept, and the solver runs in your browser — there is no server to send anything to.
Can I turn the cube myself?
Yes. Drag any sticker and that layer turns the way you pulled it. To swing
the whole cube round instead, drag the background — or, wherever you
are on the cube, use two fingers on a touch screen or
right-drag with a mouse. There are also notation buttons,
and the keys u r f d l b with shift for an anticlockwise
turn.