Guides

Google Coding for Carrots: All Level Answers, Fewest Blocks

Answers for all six levels of Google's Coding for Carrots Doodle (Celebrating 50 Years of Kids Coding), the fewest-block targets from the game file, a 7-block program that clears every level, and three answers that beat Google's target.

Coding for Carrots fewest blocks per level: Google targets 2, 5, 4, 7, 6, 6 versus Gipcus 2, 4, 4, 6, 6, 5
Google target vs shortest answer in our simulation, per level. Chart: Gipcus.

Quick answer: In Google’s Coding for Carrots Doodle (Celebrating 50 Years of Kids Coding), you snap Forward, Turn and Repeat blocks together so the bunny eats every carrot. Google’s fewest-block targets are 2, 5, 4, 7, 6 and 6 for Levels 1 to 6. One 7-block program clears all six: Repeat 100 times [Repeat 4 times (Forward, Forward, Turn right), Forward, Turn right].

By the Gipcus Guides team. Updated November 2026.

Tested by us: we found Level 4 in 6 blocks and Level 6 in 5 blocks, one fewer than Google’s targets. How we tested: we read the target numbers from the Doodle’s own game script (Dh=[2,5,4,7,6,6]), loaded its six level map files, rebuilt the bunny’s moves (it only steps forward when the next tile is walkable, and the level ends on the last carrot), then ran every shortest program on all six maps.

Coding for Carrots fewest blocks per level: Google targets 2, 5, 4, 7, 6, 6 versus Gipcus 2, 4, 4, 6, 6, 5
Google’s target vs the shortest answer our simulation found for each level. Chart: Gipcus.

What is the Google Coding for Carrots game?

It’s an interactive Google Doodle from December 2017 that marked 50 years of coding languages for kids, starting with Logo in the 1960s. You guide a rabbit across six small floating islands by stacking coding blocks, then press Run. It still works on the Google Doodles page.

How do the blocks work?

Block What it does
Forward (green) Hops one tile ahead. If the next tile isn’t walkable, the bunny stays put and the program keeps going.
Turn right / Turn left (blue) Turns on the spot without moving.
Repeat (orange) Runs the blocks inside it the number of times you set. The number counts as part of the one block.

Your score is the number of blocks, so a Repeat with three blocks inside it counts as 4. Beat or match the target and the level icon gets a ribbon. The level also ends the moment the last carrot is eaten, even if blocks are left over.

What are the answers for every Coding for Carrots level?

Each answer below matches Google’s target and passed our simulation of that level’s map. “Turn right” means the bunny’s own right.

Level Target Answer
1 2 Forward, Forward
2 5 Forward, Forward, Turn right, Forward, Forward
3 4 Repeat 4 times [Forward, Forward, Turn right]
4 7 Repeat 2 times [Repeat 4 times (Forward, Forward, Turn right), Turn right, Turn right]
5 6 Repeat 4 times [Turn left, Repeat 4 times (Forward, Forward, Turn left)]
6 6 Repeat 5 times [Repeat 6 times (Turn right, Forward, Forward), Turn right]

Can you beat Google’s target number?

Yes, on three levels in our test. These are optional, for players chasing the shortest program:

  • Level 2 in 4: Repeat 2 times [Forward, Forward, Turn right]. This only works if a Repeat block is in your toolbox on that level; otherwise use the 5-block answer.
  • Level 4 in 6: Repeat 4 times [Turn left, Repeat 6 times (Forward, Forward, Turn left)]. The bunny wastes some moves bumping into edges, which is fine because only block count matters.
  • Level 6 in 5: Repeat 5 times [Repeat 3 times (Turn left, Repeat 3 times (Forward))]. A Codeforces player reported a 5-block Level 6 back in 2020, and our run agrees.

Is there one program that solves all six levels?

Yes. Repeat 100 times [Repeat 4 times (Forward, Forward, Turn right), Forward, Turn right] uses 7 blocks and cleared all six maps in our simulation. It was first shared on Code Golf Stack Exchange, where a 6-block version is also posted. It’s slow on later levels, so be patient. If the Repeat field won’t take 100, use the per-level answers.

How do you get the shortest solution yourself?

  1. Trace the carrot path. Most levels are squares or loops, so look for a piece that repeats, such as “two hops then turn”.
  2. Wrap that piece in a Repeat. Set the count to how many sides the shape has.
  3. Use dead moves. A Forward into an edge does nothing, so a slightly “wrong” loop often still works and saves blocks.
  4. Nest Repeats. Levels 4 to 6 reward a Repeat inside a Repeat: the inner one draws a shape, the outer one turns and draws the next.

Play similar free on Gipcus

Like logic puzzles? Try Brain Test, Nonogram Master or Water Color Sort. More quick Doodle guides: Magic Cat Academy and Google Snake loop pattern, or browse our 5-minute browser games list.

FAQ

How many levels does Google Coding for Carrots have?

Six. The game’s files list L1 to L6, plus three short tutorial screens.

What is the shortest solution for Level 6?

Google’s target is 6 blocks: Repeat 5 times [Repeat 6 times (Turn right, Forward, Forward), Turn right]. Our simulation also found a 5-block answer: Repeat 5 times [Repeat 3 times (Turn left, Repeat 3 times (Forward))].

Why did I solve a level but get no ribbon?

The ribbon only appears when your block count is at or below Google’s target for that level (2, 5, 4, 7, 6, 6).

Does the Repeat number count as a block?

No. The Repeat block counts as one block whatever number you set inside it.

Where can I still play Coding for Carrots?

On the Google Doodles archive page for “Celebrating 50 years of Kids Coding”. It runs in desktop and mobile browsers.

Sources: Google Doodle game files (logo17.2.js, L1-L6.json), Google Doodles archive, Code Golf Stack Exchange, Codeforces blog 77757.

Play now

See all

Keep reading

See all