Check out my
new book!
HTML5 Games book
Play Super Mario Bros in 14kB Javascript Here's an experiment in keeping things small and confined to one Javascript file. A piece of the old Super Mario Bros Nintendo classic. There are no external image or sound files, everything is rendered with Javascript using either canvas elements or old fashioned div-making tactics (for IE).

Hey! While you're here, why don't you also check out the new Games section, a section completely dedicated to online JavaScript web games! And subscribe to the feeds to get the latest updates and games! Now let's play Super Mario...

The sprites are stored in custom encoded strings in a format that only allows 4 colors for each sprite but in turn only takes up around 40-60 bytes per sprite.

There is also MIDI music embedded as base64-encoded data: URI's. No music for IE, though, and it seems all the other browsers each have different, minor problems with it, but it "sort of" works.

It is by no means a complete clone or anything, it's not even an entire level and several key things are missing, such as mushrooms, Koopas and stuff. It was merely done as a sort of proof-of-concept and to see how small it could get.

Performance varies somewhat between the different browsers, but Firefox, Opera, Safari and IE are all playable. The latest WebKit nightly seems to give Safari a speed boost.

Be sure to click the mouse on the game if Mario won't move. When you die, you have to reload the page to start over. And yes, you can move left. Sorry.


Play Super Mario Bros without music
Play Super Mario Bros with music

Or try the larger double size version:
Play Super Mario Bros (2X) without music or Play Super Mario Bros (2X) with music

The script has been compressed to 14kb with the YUI compressor.
Here's the uncompressed script (35kb), if anyone is interested. The structure may look a bit weird, a lot of things have been moved around to get better compression.


If you liked this, be sure to check out the Super Mario Kart JavaScript game as well. Have fun!
⇓ 238 comments «Oldest   ‹Older   201 – 238 of 238   Newer›   Newest» Anonymous

Nice

how can i use on my homepage !

April 26, 2008 at 3:52 AM
Jonathan Coletta

Mis felicitaciones!

April 27, 2008 at 6:21 PM
Anonymous

Amazing work man!

May 1, 2008 at 8:46 AM
Anonymous

cool bro.. :D

May 14, 2008 at 7:57 AM
Anonymous

Very impressive work indeed. For the most people, when you look at the MBs a kit has one can pretty much say if it is a complex software/script o not. This one sure beats the rules :)

May 15, 2008 at 6:30 AM
Anonymous

EEXCELLLENT!!!!! EEXCELLLENT!!!!! EEXCELLLENT!!!!! on my Multi-core 64 bit firefox 3rc1 works flawlessly.

June 2, 2008 at 7:26 PM
Anonymous

detox foot bath
ion cleanse

June 5, 2008 at 1:05 AM
Anonymous

You my friend are An Hero. Will you have my baby?

June 8, 2008 at 6:55 PM
Anonymous

how do u down load it ?

June 9, 2008 at 9:03 PM
Anonymous

how do u download it?

June 9, 2008 at 9:03 PM
red

thank you mirc

June 17, 2008 at 8:43 AM
Anonymous

It works fine for me under FF 3, beta 5. Very nice. :)

kral oyun
oyunlar
oyunlar

July 7, 2008 at 8:50 AM
Anonymous

The best Super Mario Games in flash.

http://jogosdomario.jogosja.com

July 18, 2008 at 2:07 AM
Anonymous

cool....

Best regard,
priyadi.co.nr

August 6, 2008 at 5:31 AM
red

http://www.google.com.tr/search?hl=tr&suggon=0&q=m%C4%B1rc&start=30&sa=No

August 12, 2008 at 8:56 AM
Anonymous

So very cool. And yet... if we have so many 'nerds' out there with THIS much time on their hands... maybe we can cure cancer or something. *laughs*

August 18, 2008 at 11:15 AM
Anonymous

Well done, I work with this stuff, and I can only say kudos...!

MuZui.com

September 4, 2008 at 3:21 AM
Anonymous

Very useful,thanks a lot!

October 21, 2008 at 8:50 PM
Anonymous

it is full of s***t

November 3, 2008 at 6:13 AM
Anonymous

great, I've finishd with 165 s left ^^

with firefox3.1 it's pretty fast

November 12, 2008 at 11:14 AM
Anonymous

jajaja,,,,,,,q farsa ese mario bross,,,,,,,,,,,,:D

November 29, 2008 at 7:56 PM
Anonymous

Cool!

December 8, 2008 at 5:50 PM
Anonymous

You had pretty beautiful technology of javascript!

December 9, 2008 at 5:59 AM
Anonymous

surprised

December 10, 2008 at 10:00 PM
Anonymous

cool

December 11, 2008 at 6:42 AM
Anonymous

Great Job!!!, now in going to try at home :P

December 16, 2008 at 4:57 PM
Unknown

I found a little bug - when you die, you still have the ability to jump, but only straight up. Nothing major, just a weird little thing I noticed.

December 29, 2008 at 7:16 PM
acceptcreditcards

I am gonna share with you all a website where you can
play for free all Mario Bros Games online

The site is: MarioBros.com.net.gt

checkit, you're gonna love the site too !!

January 1, 2009 at 10:30 PM
Anonymous

im working on a mario game myself, for a school project but im having a difficult time starting up
u got any ideas

January 5, 2009 at 6:35 AM
Anonymous

lol it's funny, you can still jump when you died ^^

January 6, 2009 at 7:47 AM
Anonymous

this is amazing

January 17, 2009 at 3:34 PM
Anonymous

what is up

the wall is up, of course

my name is tuck, from Madagascar

would you like to be my friend

February 8, 2009 at 10:14 PM
Anonymous

Well done!!

February 25, 2009 at 6:58 AM
Anonymous

i love mario

March 25, 2009 at 4:17 PM
Tukang Nggame

wow..
it's a "dark age" game, he he he...

but i still love this game...

great post..
thanks :)

April 12, 2009 at 4:06 AM
ShadowCry

Great site man!!!

April 22, 2009 at 3:56 AM
Anonymous

Works great on my Opera but it doesn't restart right away.

Great work!

April 24, 2009 at 1:47 AM
Anonymous

Air Jordan 1

May 12, 2009 at 12:01 AM
Post a Comment