Note: I've done some work on the site here recently.
Some things may not work quite right. Don't panic! :-)
Just drop me an email if you see something strange.

Scripts for Educators: Free Perl/CGI programs since 1996


Free Online Blackjack (21) Program


Need Help?
Try the FAQ!
Hit the Forum!
Contact Me!

Programs & Scripts 


Make Your Own..
Web Page
Page Counter
Email form



Information Lookup
SillySearch (site search)


Other scripts


Other Resources

About this Site
Who's Kristina? :-)

Help & Support
Getting started
Check the FAQ!
Discussion forum
Request Support
Mailing Lists

Offsite Resources
Links and other stuff
Web Hosting providers
Online tutorials
Custom Programming
More Scripts (HotScripts)
Sites for Teachers

Support This Site!
Donate - not just money!
Buy from VisualPeace
Buy from Everything's Online!
Buy from MonsterMadness
Buy from


[Demo] [Who's using?] [System Requirements] [Download!] [Bug Fix Announcements] [Changelog] [License]

Program Summary

[Version 1.0.3 Released 10/27/2005]

SFEBlackJack lets you set up a simple, online Blackjack game on your website. Also known as "21", the object of online Blackjack is the same as regular casino Blackjack: whoever gets closest to 21, without going over 21, wins the game.

It's occurred to me that some of you may wonder what a card game is doing on a site called "Scripts for Educators." :-) Believe it or not, there are some teachers who like using card games such as this to illustrate concepts such as probability, random chance, arithmetic skills (card counting) and even ESL vocabulary. (See, for example, this article by Robin Day about teaching ESL with playing cards linked from the version of SFEBlackJack at

In this program, we use a single "deck" of cards. On each game, the deck is created, then "shuffled" so that the cards are in a random order. The dealer's cards and player's cards are dealt from the deck, and the rest of the deck is saved to deal other cards from.

General Rules of Blackjack

The blackjack game begins with the dealer drawing two cards, one of which is face down, so you do not know what it is, and you drawing two cards. Aces can be 1 point or 11 points, whichever is most advantageous to the player.

"Face" cards such as Queen, King, and Jack are all worth 10 points.

If you draw an ace and a 10 on the first round, that is called "Blackjack" and you automatically win two and a half times your bet. (This game starts you off with 100 "credits" and bets 5 each time automatically.) The only exception is if the dealer has also drawn a blackjack, in which case, it is a "push" or a tied game.

You may click "Hit" to draw another card, "Stand" to stay with the cards you have, or "Surrender" to give up and get half your bet back.

If your cards total 10 or 11 on the first draw, you may "Double Down," meaning that you double your bet, draw only one more card, and hope to win.

The game should keep track of how many credits you have through the use of cookies.

Warning: online Blackjack can be addictive, even a simple game like this. While I was writing it, I ended up playing for several hours. You wouldn't think a silly game like this would be able to trick you into playing blackjack all day, but sometimes it can.

Have FUN!



Working Demo

To view a working demo version of this program, please   click here.


Who's Using SFEBlackJack?

 If you've gotten SFEBlackJack to work, send me the address of your website and I'll post a link to it.

SFEBlackJack has only recently been released, so I only know of a few sites using it! If you've gotten it to work on your site, drop me a line and I'll link to your blackjack game here.

You can find a few examples of people using it with this Google search. This search will also show some links with "Ooooops! Configuration Error!" This is what happens if the script hasn't been configured correctly. If this happens to you, and you don't know how to fix it, remember, you can always ask me for help. :-)
It also appears to be in use at
And at along with SFEPoker and SFEHangMan.


System Requirements

The web server where this script will be installed must have Perl 5.000 or higher. Scripts that send email require that "Sendmail" or "qmail-inject" be available on Unix/Linux-type systems. Scripts that send email under Windows-based systems require use of the Socket Perl module ( All scripts may require the Perl CGI module, .

This script is NOT supported on the following web hosting providers:

Also, sorry, but the scripts are not supported under mod_perl, PerlEx, or speedy_cgi as I don't have any way to test them in that environment. :-(

You must be able to execute cgi programs on your web server. If you're not sure whether you have permission to do this, or are not sure how to configure the files, please ask your system administrator, or check the web pages of your web hosting provider for Help or Support information. For a free web hosting provider who supports CGI scripts, or low-cost web hosting providers, you can try looking at the "Some Places to Host your Website" page I've put together.

The web server must support both the GET and POST request methods. (Ask your hosting provider about this if you're not sure.)

Please remember: you get what you pay for, and free web hosting services are often worth what you pay for them.



But first, the obligatory plea for funding. :-)
(Scroll down if you don't want to read this part. You do NOT have to give money to download these scripts!)

Like the scripts? Give me a dollar, or say thanks! 

If you like the scripts, you can send me cash through PayPal, Amazon, or through snail mail or you can show your support in other ways. Remember: only about one out of 100 people who download the scripts even says "Thanks." :-)

All the files you need are contained in these packages. Download it in the format you wish.

Gzipped Tar format: sfeblackjack.tar.gz
Zip format:

On a Unix-type system, if you have console or command prompt access, you may unzip the tar.gz file by typing 'gunzip < sfeblackjack.tar.gz | tar -xvf -'. If you're not very familiar with Unix, you may want to ask someone who is to help you. The latest version of Stuffit for the Mac will also handle tar.gz files.

If you have MS Windows, there is a program called WinZip (available at TuCows) which will uncompress and de-archive tar/gz files as well as Zip files.

The package contains the following files:

The actual online BlackJack program . This script is pretty much standalone, in the sense that it creates all the Blackjack games on the fly, calculates the scores and winnings, etc.
contains information on how to get started using the program. READ this before trying to install this!


Bug Fix Announcements

I strongly recommend that you sign up here for update and bug fix announcements about this script. I will not spam you with advertising: I just want to make sure you have the latest fixes. :-)

The program will send a confirmation message to your email address when you sign up. In order to get on the announcement list, you MUST click on the confirmation link contained in that email message. This is to protect you from someone signing you up as a joke, and to protect me from being accused of spamming. Since update announcements are sometimes few and far between, sometimes people forget that they've subscribed and report me for sending junk mail. Luckily, the system logs the address, time, and date of everyone who signs up so that I can prove I'm only sending to people who asked for it. :-)

After a major release, you may get one or two messages a week. Mostly, though, I'm afraid it's less than once a month. 

You may also sign up for announcements about other scripts on the main Scripts for Educators Mailing List page. 

This list is ONLY for announcements specifically about SFEBlackJack: