Projects › Games › Solitaire

Play solitaire free online, then make your own with AI

You can play classic Klondike solitaire free right here, on a computer, tablet or phone, with no sign-up. Drag the cards, or tap one to send it to the best place. Pick Draw 1 for a gentler game or Draw 3 for the classic challenge, and undo as often as you like. Your game is kept in this browser if you close the tab. Then build your own solitaire game with a free AI assistant.

Medium 1 to 2 hours to build your own Free · no sign-up Works on phones
Time0:00 Moves0 Best–

Drag a card, or tap it to move it to the best place. Tap the deck in the top left to turn cards over. The time starts on your first move, and your best time stays in this browser.

How to play

Solitaire rules in a minute

The aim is to move all 52 cards onto the four piles in the top right, one pile per suit, from Ace up to King.

  • The seven columns. You can put a card on one that is one higher and the other colour, such as a red 6 on a black 7. You can move a run of cards together.
  • Empty columns. Only a King, or a run starting with a King, can go in an empty column.
  • Face-down cards. When you move the last face-up card off a column, the card below turns over.
  • The deck. Tap it to turn over one card (Draw 1) or three (Draw 3). Only the top card you turned can be played. When the deck runs out, tap the empty space to turn the pile back over.
  • Top right piles. Start each one with an Ace, then add 2, 3, 4 and so on in the same suit. You can take a card back down if you need it.

When every card is face up and the deck is used up, the game finishes itself.

Win more games

Solitaire tips

  • Turn over face-down cards first. A move that uncovers a hidden card is nearly always better than one from the deck.
  • Work on the longest columns. They hide the most cards.
  • Don't empty a column without a King to put in it. An empty space you can't fill is wasted.
  • Don't rush cards to the top right. A low card in the columns can be a useful step for the other colour. Ace and 2 are always safe to send up.
  • Use Undo to explore. Try a line, and if it goes nowhere, go back. Not every deal can be won, even by perfect play.
What you'll build

Your own solitaire game

You'll describe it to a free AI assistant, paste what it writes into a file, and open it in your browser. No coding needed, and you can give it your own card backs, colours and rules.

An AI chat assistantClaude, ChatGPT or Gemini. The free version is fine.
A plain text editorNotepad (Windows) or TextEdit (Mac; choose Format then Make Plain Text first).
A web browserAny one will do.
First time? Read How to save and open an HTML file. It takes two minutes.
Step by step

Build it in five steps

Step 1 gives you a table with cards on it, and each step after it adds more. Yours will look a bit different from the one above, because the AI writes its own version each time.

  1. Deal the cards

    Copy this prompt into your AI assistant:

    Copy this prompt
    I don't know how to code. Please make me a Klondike solitaire card game that runs in a web browser.
    
    For this first version:
    - ONE single HTML file (HTML, CSS and JavaScript together), no external libraries, no image files, no internet needed. I will save it and double-click it.
    - A dark green table. Draw the cards with HTML and CSS: white cards with rounded corners, the rank and suit in the top-left corner, and a big suit symbol in the middle. Hearts and diamonds red, spades and clubs black. Face-down cards show a patterned back.
    - Shuffle a 52-card deck and deal it the Klondike way: seven columns with 1 to 7 cards, only the bottom card of each face up, fanned downwards so you can see each card's corner.
    - The rest of the cards go in a face-down deck in the top-left corner, with a space beside it for turned-over cards, and four empty spaces in the top right for the Ace piles.
    - Clicking the deck turns over one card. When the deck is empty, clicking it turns the pile back over.
    - A "New game" button.
    
    Please give me the complete file in one code block, then tell me in simple steps how to save and open it.

    Copy the code, paste it into your text editor and save it as solitaire.html. Double-click it, then click the deck to turn some cards over.

  2. Move cards by dragging

    Copy this prompt
    That works, thank you. Now let me move cards, following the rules:
    - Drag a face-up card with the mouse or a finger (use pointer events so it works on touch screens too). If I drag a card in a column, the cards below it come along.
    - On a column, a card can go on one that is one higher and the other colour. Only a King can go in an empty column.
    - On the Ace piles, start with an Ace, then the same suit going up. Only one card at a time.
    - When I let go, drop the cards on whichever allowed pile they overlap most. If none, slide them back.
    - When the last face-up card leaves a column, turn the card below it face up.
    - Make the cards slide smoothly when they move.
    Send me the complete updated file.
    Always ask for the complete file. Replace everything in solitaire.html, save, and refresh the tab (F5 or Cmd+R).
  3. Tap to move, and undo

    Copy this prompt
    Please add:
    - Tapping or clicking a card (without dragging) moves it to the best place: an Ace pile if it fits, otherwise a column it fits on. If it can't go anywhere, give it a little shake.
    - An "Undo" button that goes back one move at a time, all the way to the start. Ctrl+Z (Cmd+Z on a Mac) does the same.
    - A move counter and a timer that starts on the first move.
    Send me the complete updated file.
  4. Add Draw 3 and winning

    Copy this prompt
    Please add:
    - "Draw 1" and "Draw 3" buttons. In Draw 3, clicking the deck turns over three cards, shown slightly fanned, and only the top one can be played.
    - When every card is face up and the deck is used up, move the rest of the cards onto the Ace piles by themselves, one at a time, lowest first.
    - When all four Ace piles reach the King, show "You won!" with the time and moves, and a "Deal again" button.
    - Remember my best time for Draw 1 and Draw 3 separately in localStorage, and show it next to the timer.
    Send me the complete updated file.
  5. Make it work well on a phone

    Copy this prompt
    Please make it fit any screen:
    - Work out the card width from the table's width so all seven columns always fit, from a small phone to a big monitor (no wider than 100 pixels). Size the corner rank and suit from the card width so they stay readable.
    - If a column gets too long for the screen, squeeze the face-up cards closer together.
    - Re-measure when the window is resized or the phone is turned.
    - Stop the page scrolling while I drag a card on a phone.
    - Save the game in localStorage after every move, so if I close the tab and come back, my game is still there.
    Send me the complete updated file.
    To try it on your phone, put the file online for free with this hosting guide, or email it to yourself and open it there.
ADVERTISEMENT · IN-ARTICLE
If it goes wrong

Quick fixes

Cards don't drag on my phone

Ask the AI: "Use pointer events (pointerdown, pointermove, pointerup) instead of mouse events, and add touch-action: none to the cards so the page doesn't scroll while I drag."

A dragged card disappears under other cards

Ask the AI to "give the dragged cards a very high z-index while they are moving, and put the normal order back when they land".

It lets me make moves that break the rules

Describe the exact move, such as "it let me put a red 5 on a red 6", and ask the AI to check the colour and the rank before allowing a move.

Undo puts cards back wrong

Ask the AI to "save a copy of every pile, including which cards are face up, before each move, and have Undo put that copy back".

The suits show as coloured emoji

Some phones turn ♥ and ♦ into emoji. Ask the AI to "draw the four suit symbols as small SVG shapes instead of text characters".

It opens as text

Re-save as plain text with exactly .html at the end, not .txt.

Questions

Questions people ask

Is this solitaire game free?

Yes. It's free with no sign-up and no download, and it runs in your own browser.

Which solitaire is this?

It's Klondike, the classic version most people mean by "solitaire": seven columns, a deck to turn over, and four piles to build from Ace to King.

What's the difference between Draw 1 and Draw 3?

Draw 1 turns over one card from the deck at a time, so you see every card on each pass and win far more often. Draw 3 turns over three and only lets you play the top one, which is the classic, harder game. You can switch at any time.

Can I play solitaire on my phone?

Yes. Drag cards with your finger, or just tap a card and it moves to the best place it can go.

Will I lose my game if I close the page?

No. Your game in progress is kept in this browser, so it's still there when you come back on the same device. Press New game to start over.

Can every game of solitaire be won?

No. Some deals can't be won however you play, though most Draw 1 games can be with careful play and a few undos. If you're stuck, press New game.

Make it your own

Twist it into something else

Your own card backs

a photo, your team colours or a pattern you design

Spider solitaire

two decks and ten columns, building runs of one suit

FreeCell

every card face up, with four free spaces to park cards

Daily deal

the same shuffle for everyone each day, with best times

Hint button

shows a good move when you're stuck

Big-card mode

extra large cards and numbers for easier reading

Keep going

What to build next