Pencil is a collaborative programming site for drawing art, playing music, and creating games. Pencil is also a place to experiment with mathematical functions, geometry, graphing, webpages, simulations, and algorithms. Programs are open for all to see and copy.

Watch a video overview or watch a video tutorial.

The main language is Coffeescript. Professional software engineers use Coffeescript to build complex websites, but Coffeescript code can also be very simple.

Play three notes:

play 'CDE'
Draw a gold star:

pen gold
for x in [1..5]
  fd 100
  rt 144
Follow the mouse:

speed Infinity
tick 3, ->
  turnto lastmousemove
  fd 15
  dot green

Programs preload the pencilcode library to use functions such as pen (sets the turtle's pen color), fd (moves the turtle forward), and play (plays musical notes). Pencil is all open source. Hang out on the Pencil discussion forum or check out the quick reference or the online guide to find out more. There is also an illustrated Pencil Code book with more than 100 small projects.

Anybody can save programs and web pages, but read the Terms of Service and the Privacy Policy first. Two rules:

Be Nice. Do not mess up other peoples' work. Do not post content that detracts from education on the site. This a learning space that is not locked down (for example, passwords are optional). So feel free to explore, create, and link, but also please be considerate.

Be Careful. Do not depend on Pencil to keep your data safe. Data posted here is public, and data is not secured from loss. Do not post private or personally identifiable information. Passwords on Pencil do not prevent malicious interference.

The Pencil Code Foundation, Inc., is devoted to advancing computer science education by making programming as simple and as powerful as using a pencil. Contribute to the development of Pencil Code at or github.  —


What's this?
See the guide
I'm new here. Let's play. blank editor

A Modern Sandbox
For Little Programs

By the Pencil Code Foundation -

Want to improve Pencil Code? Participate in an open-source Hackathon.