BASIC instinct
Celebrate 50 years of Microsoft with the company’s original source code
Before there was Office or Windows 95 or Xbox or AI, there was Altair BASIC.

Source Code
By Bill Gates
April 2, 2025
BASIC INSTINCT
Celebrate 50 years of Microsoft with the company’s original source code
Before there was Office or Windows 95 or Xbox or AI, there was Altair BASIC.
The Coolest Code I’ve Ever Written
In 1975, Paul Allen and I created Microsoft because we believed in our vision of a computer on every desk and in every home. Five decades later, Microsoft continues to innovate new ways to make life easier and work more productive. Making it 50 years is a huge accomplishment, and we couldn’t have done it without incredible leaders like Steve Ballmer and Satya Nadella—along with the many people who have worked at Microsoft over the years. Although I am excited to celebrate the anniversary, reaching this milestone feels bittersweet. I always love reflecting back on Microsoft’s history and dreaming about its future. But it’s also hard to believe that such a significant piece of my life has been around for a half-century! It feels like just yesterday that Paul and I were hunched over the PDP-10 in Harvard’s computer lab, writing the code that would become the first product of our new company.

This magazine cover changed my life.
Paul and I fell in love with computers while we were students at Lakeside.
That code remains the coolest code I’ve ever written to this day—and you can see it for yourself at the bottom of this page. The story of how Microsoft came to be begins with, of all things, a magazine. The January 1975 issue of Popular Electronics featured an Altair 8800 on the cover. The Altair 8800, created by a small electronics company called MITS, was a groundbreaking personal computer kit that promised to bring computing power to hobbyists. When Paul and I saw that cover, we knew two things: the PC revolution was imminent, and we wanted to get in on the ground floor. At the time, personal computers were practically non-existent. Paul and I knew that creating software that let people program the Altair could revolutionize the way people interacted with these machines. So, we reached out to Ed Roberts, the founder of MITS, and told him we had a version of the programming language BASIC for the chip that the Altair 8800 ran on.
There was just one problem: We didn’t. It was time to get to work.
The Basics of BASIC
Invented by two Dartmouth College professors in 1964, BASIC was designed to be easy to learn for people with no computer experience. With little study or technical aptitude, a person can write their own software in BASIC—anything from a checkbook-balancing program to a tic-tac-toe game. BASIC was the first language Paul and I learned (and it’s still used today). Computer languages like BASIC serve the same purpose as English or any other language. In the same way that you can use English to order a coffee at a café, you can use BASIC to tell a computer to run a program, solve a math problem, or perform some other task.
Altair 8800
Translating Basic
There is a catch, though: Computers don’t speak BASIC. And the language they do speak is so complex and unintuitive that programming in it is incredibly difficult. To bridge the gap, Paul and I set out to create a BASIC interpreter, which would translate code into instructions the computer understood line by line as the program runs. We considered creating a similar tool called a compiler that translates the entire program and then runs it all at once. But we figured the line-by-line approach of an interpreter would be helpful to novice programmers since it would give instant feedback on their code, allowing them to fix any mistakes as they crop up.
There is no better feeling than when you learn that your approach works.
I was always a very good math student and found that the logic and problem-solving needed in math helped me learn computer programming.
Paul and I went to school with Ric Weiland, who later became Microsoft's second employee.
Getting Started
Paul and I decided to divide and conquer. We didn’t have the Intel 8080 chip that the Altair computer ran on, so Paul got to work writing a program that would simulate one on Harvard’s PDP-10 mainframe. This allowed us to test our software without needing an actual Altair. Meanwhile, I focused on writing the main code for the program while another friend, Monte Davidoff, worked on a portion called the math package. We coded day and night for the two months to create the software we had said already existed.
The mainframe of Harvard's PDP-10
Overcoming obstacles
Computer memory back then was expensive. Extra memory for the Altair could easily cost more than the computer itself, so every byte mattered. We thought that if we could fit our BASIC code into just four kilobytes, Altair owners using BASIC could still have enough memory left to run the programs they wrote (and not have to spend a lot of extra money). To meet that constraint, I used various techniques to optimize memory usage, like compact data structures and efficient algorithms. It was a fun challenge, and although Paul and I were stressed about getting Altair BASIC to MITS as quickly as possible, I had a blast figuring out how to make everything fit.
The Birth of Microsoft
Finally, after lots of sleepless nights, we were ready to show our BASIC interpreter to Ed Roberts, the president of MITS. The demonstration was a success, and MITS agreed to license the software. This was a pivotal moment for Paul and me. Altair BASIC became the first product of our new company, which we decided to call Micro-Soft. (We later dropped the hyphen.) You can read more about the origin of Altair BASIC—including about how Paul had to finish part of the code on a flight to Albuquerque—in my memoir Source Code. It’s amazing to think about how this one piece of code led to a half century of innovation from Microsoft. Before there was Office or Windows 95 or Xbox or AI, there was the original source code—and I still get a kick out of seeing it, even all these years later.
Microsoft turns 50 years old tomorrow. As we’ve gotten closer to the anniversary, I have found myself reflecting back on the journey that led us to this point—and especially on the people who got us here.
In 1975, Paul Allen and I created Microsoft because we believed in our vision of a computer on every desk and in every home. That vision became a reality long ago, and in the years since, Microsoft has continued to build a future where innovation makes life easier and work more productive. We couldn’t have done it without incredible leaders like Steve Ballmer and Satya Nadella. Every single person who has worked at Microsoft over the years is a key part of its success too.
The truth is, for much of my life, I didn’t like to celebrate work milestones. When I was at Microsoft, I would insist we didn’t have time to talk about them. But as I got older, I learned how important it is to celebrate the wins in life. And making it 50 years is a huge cause for celebration.
The coolest code I’ve ever written
Although I am excited to join Steve, Satya, and everyone who helped make the company a success tomorrow in Redmond to celebrate its anniversary, I admit that reaching this milestone feels bittersweet. It’s hard to believe that such a significant piece of my life has been around for a half-century!
It feels like just yesterday that Paul and I were hunched over the PDP-10 in Harvard’s computer lab, writing the code that would become the first product of our new company.
That code remains the coolest code I’ve ever written to this day—and you can see it for yourself at the bottom of this page.
The story of how Microsoft came to be begins with, of all things, a magazine. The January 1975 issue of Popular Electronics featured an Altair 8800 on the cover. The Altair 8800, created by a small electronics company called MITS, was a groundbreaking personal computer kit that promised to bring computing power to hobbyists. When Paul and I saw that cover, we knew two things: the PC revolution was imminent, and we wanted to get in on the ground floor.
At the time, personal computers were practically non-existent. Paul and I knew that creating software that let people program the Altair could revolutionize the way people interacted with these machines. So, we reached out to Ed Roberts, the founder of MITS, and told him we had a version of the programming language BASIC for the chip that the Altair 8800 ran on.
There was just one problem: We didn’t. It was time to get to work.
The basics of BASIC
Invented by two Dartmouth College professors in 1964, BASIC was designed to be easy to learn for people with no computer experience. With little study or technical aptitude, a person can write their own software in BASIC—anything from a checkbook-balancing program to a tic-tac-toe game. BASIC was the first language Paul and I learned (and it’s still used today).
Computer languages like BASIC serve the same purpose as English or any other language. In the same way that you can use English to order a coffee at a café, you can use BASIC to tell a computer to run a program, solve a math problem, or perform some other task.
Translating BASIC
There is a catch, though: Computers don’t speak BASIC. And the language they do speak is so complex and unintuitive that programming in it is incredibly difficult. To bridge the gap, Paul and I set out to create a BASIC interpreter, which would translate code into instructions the computer understood line by line as the program runs.
We considered creating a similar tool called a compiler that translates the entire program and then runs it all at once. But we figured the line-by-line approach of an interpreter would be helpful to novice programmers since it would give instant feedback on their code, allowing them to fix any mistakes as they crop up.
Getting started
Paul and I decided to divide and conquer. We didn’t have the Intel 8080 chip that the Altair computer ran on, so Paul got to work writing a program that would simulate one on Harvard’s PDP-10 mainframe. This allowed us to test our software without needing an actual Altair. Meanwhile, I focused on writing the main code for the program while another friend, Monte Davidoff, worked on a portion called the math package. We coded day and night for the two months to create the software we had said already existed.
Overcoming obstacles
Computer memory back then was expensive. Extra memory for the Altair could easily cost more than the computer itself, so every byte mattered. We thought that if we could fit our BASIC code into just four kilobytes, Altair owners using BASIC could still have enough memory left to run the programs they wrote (and not have to spend a lot of extra money). To meet that constraint, I used various techniques to optimize memory usage, like compact data structures and efficient algorithms. It was a fun challenge, and although Paul and I were stressed about getting Altair BASIC to MITS as quickly as possible, I had a blast figuring out how to make everything fit.
The birth of Microsoft
Finally, after lots of sleepless nights, we were ready to show our BASIC interpreter to Ed Roberts. The demonstration was a success, and MITS agreed to license the software. This was a pivotal moment for Paul and me. Altair BASIC became the first product of our new company, which we decided to call Micro-Soft. (We later dropped the hyphen.)
You can read more about the origin of Altair BASIC—including about how Paul had to finish part of the code on a flight to Albuquerque—in my memoir Source Code.
It’s amazing to think about how this one piece of code led to a half century of innovation from Microsoft. Thanks to leaders like Steve and Satya, the company has reached levels of success that Paul and I could only dream of all those years ago in the Harvard computer lab.
Before there was Office or Windows 95 or Xbox or AI, there was the original source code—and I still get a kick out of seeing it, even all these years later.
DOWNLOAD THE CODE
Look through the original Microsoft source code for yourself. Computer programming has come a long way over the last fifty years, but I’m still super proud of how it turned out.



Starting line
My first memoir is now available
Source Code runs from my childhood through the early days of Microsoft.

I was twenty when I gave my first public speech. It was 1976, Microsoft was almost a year old, and I was explaining software to a room of a few hundred computer hobbyists. My main memory of that time at the podium was how nervous I felt. In the half century since, I’ve spoken to many thousands of people and gotten very comfortable delivering thoughts on any number of topics, from software to work being done in global health, climate change, and the other issues I regularly write about here on Gates Notes.
One thing that isn’t on that list: myself. In the fifty years I’ve been in the public eye, I’ve rarely spoken or written about my own story or revealed details of my personal life. That wasn’t just out of a preference for privacy. By nature, I tend to focus outward. My attention is drawn to new ideas and people that help solve the problems I’m working on. And though I love learning history, I never spent much time looking at my own.
But like many people my age—I’ll turn 70 this year—several years ago I started a period of reflection. My three children were well along their own paths in life. I’d witnessed the slow decline and death of my father from Alzheimer’s. I began digging through old photographs, family papers, and boxes of memorabilia, such as school reports my mother had saved, as well as printouts of computer code I hadn't seen in decades. I also started sitting down to record my memories and got help gathering stories from family members and old friends. It was the first time I made a concerted effort to try to see how all the memories from long ago might give insight into who I am now.
The result of that process is a book that will be published on Feb. 4: my first memoir, Source Code. You can order it here. (I’m donating my proceeds from the book to the United Way.)
Source Code is the story of the early part of my life, from growing up in Seattle through the beginnings of Microsoft. I share what it was like to be a precocious, sometimes difficult kid, the restless middle child of two dedicated and ambitious parents who didn’t always know what to make of me. In writing the book I came to better understand the people that shaped me and the experiences that led to the creation of a world-changing company.
In Source Code you’ll learn about how Paul Allen and I came to realize that software was going to change the world, and the moment in December 1974 when he burst into my college dorm room with the issue of Popular Electronics that would inspire us to drop everything and start our company. You’ll also meet my extended family, like the grandmother who taught me how to play cards and, along the way, how to think. You’ll meet teachers, mentors, and friends who challenged me and helped propel me in ways I didn’t fully appreciate until much later.
Some of the moments that I write about, like that Popular Electronics story, are ones I’ve always known were important in my life. But with many of the most personal moments, I only saw how important they were when I considered them from my perspective now, decades later. Writing helped me see the connection between my early interests and idiosyncrasies and the work I would do at Microsoft and even the Gates Foundation.
Some of the stories in the book were hard for me to tell. I was a kid who was out of step with most of my peers, happier reading on my own than doing almost anything else. I was tough on my parents from a very early age. I wanted autonomy and resisted my mother’s efforts to control me. A therapist back then helped me see that I would be independent soon enough and should end the battle that I was waging at home. Part of growing up was understanding certain aspects of myself and learning to handle them better. It’s an ongoing process.
One of the most difficult parts of writing Source Code was revisiting the death of my first close friend when I was 16. He was brilliant, mature beyond his years, and, unlike most people in my life at the time, he understood me. It was my first experience with death up close, and I’m grateful I got to spend time processing the memories of that tragedy.
The need to look into myself to write Source Code was a new experience for me. The deeper I got, the more I enjoyed parsing my past. I’ll continue this journey and plan to cover my software career in a future book, and eventually I’ll write one about my philanthropic work. As a first step, though, I hope you enjoy Source Code.



Source Code
The brilliant teachers who shaped me
In my new book, I give credit where it’s due.

I was an extremely lucky kid. I was born to great parents who did everything to set me up for success. I grew up in a city I love and still call home, at the dawn of the computer age. And I went to one of two schools in my state—one of a handful in the country—that actually had computer access. These were all strokes of luck that helped shape my future.
But equally important, maybe most important, were the teachers I was fortunate enough to learn from along the way. In my new book, Source Code, I write about many of them. From grade school through college, I had teachers who saw my potential (even when it was buried under bad behavior), gave me real responsibilities, let me learn through experience instead of lectures, and created space for me to explore my passions.
These five brilliant teachers didn’t just teach me subjects; they taught me how to think about the world and what I might accomplish in it. Looking back, I realize how rare this was—and how lucky I was to find it over and over again.
Blanche Caffiere
Blanche Caffiere entered my life twice—first as my first-grade teacher, and later as my first “boss,” when I was in fourth grade at View Ridge Elementary and she was the librarian. At the time, I was a handful in (and out of) class: energetic, disruptive, constantly lost in my own thoughts. Most teachers and administrators saw me as a problem to be solved. But Mrs. Caffiere saw a problem-solver in me instead. When one of my teachers struggled with how to challenge me and channel my energy, she stepped in and gave me a job as her library assistant.
“What you need is kind of like a detective,” I said when she tasked me with finding missing books that were lost somewhere in the library. I warmed to the work immediately, roaming the stacks until I found each one. Then Mrs. Caffiere taught me the Dewey Decimal system by having me memorize a clever story about a caveman, so I could figure out where each book belonged. For a kid who loved reading and numbers, it was a dream job. I felt essential. I stayed through recess that first day, showed up early the next morning, and ended up working in the library for the rest of the year.
When my family moved and I had to leave View Ridge Elementary, I was most devastated about leaving my library job. “Who will find the lost books?” I asked. Mrs. Caffiere responded that I could be a library assistant at my new school. She understood that what I needed wasn’t just busy work, but a sense of being valued and trusted with real responsibility. She’d been teaching for nearly forty years when we met, which meant she’d seen every kind of student imaginable. But she had a particular gift for helping those at the extremes—the ones who were struggling or excelling—find their way. I was a little of both, and she certainly helped me find mine.
Paul Stocklin
Paul Stocklin’s eighth-grade math class at Lakeside changed my life in two profound ways, though I couldn’t have known it at the time. First, it was where I met Kent Evans, who would become my best friend and earliest “business” partner before his tragic death in a mountain climbing accident at age 17. Like me, Kent didn’t easily fit into the established cliques at Lakeside. Unlike me, he had a clear vision for his future, which inspired me to start thinking about my own.
It was also in Mr. Stocklin’s class that I first saw a teletype machine—an encounter that would shape my entire future. One morning, Mr. Stocklin led our class down a hall in McAllister House, a white clapboard building at Lakeside that was home to the school’s math department, where we heard an unusual “chug-chug-chug” sound echoing from inside a room. There, we saw something that looked like a typewriter with a rotary telephone dial. Mr. Stocklin explained that it was a teletype machine connected to a computer in California. With it, we could play games and even write our own computer programs—something I’d never thought I’d be able to do myself. That moment opened up a whole new world for me.
There’s a lot more I’ve come to appreciate about Mr. Stocklin, including how much he encouraged an early love of math in me. But it’s undeniable that he changed my life by facilitating two of the most important relationships of my early years: my friendship with Kent, and my introduction to computing. These were gifts from him that I’ll appreciate forever, even though one would end in heartbreak.
Bill Dougall
Bill Dougall embodied what made Lakeside special—he was a World War II Navy pilot and Boeing engineer who brought real-world experience to teaching. Beyond his degrees in engineering and education, he had even studied French literature at the Sorbonne. He was the kind of Renaissance man who took sabbaticals to build windmills in Kathmandu.
As head of Lakeside’s math department, Mr. Dougall was instrumental in bringing computer access to our school, something he and other faculty members pushed for after taking a summer computer class. Even though it was expensive—over $1,000 a year for the terminal and thousands more in computer time—he helped convince the Mothers’ Club to use the proceeds from their annual rummage sale to lease a Teletype ASR-33.
The fascinating thing about Mr. Dougall was that he didn’t actually know much about programming; he exhausted his knowledge within a week. But he had the vision to know it was important and the trust to let us students figure it out. His famous camping trips, a sacred tradition at Lakeside, showed another side of his belief in experiential learning. These treks took students through whatever weather the Pacific Northwest could throw at forty boys and a few intrepid teachers. They taught resilience, teamwork, and problem-solving in a way that no classroom ever could. That was the essence of Mr. Dougall’s teaching philosophy.
Fred Wright
Fred Wright was exactly the kind of teacher we needed in the computer room at Lakeside. He had no practical computer experience, though he’d studied the FORTRAN programming language. But he was relatively young (in his late twenties) and only recently hired, and he intuitively understood that the best way to get students to learn was to let us explore on our own terms. There was no sign-up sheet, no locked door, no formal instruction.
Instead, Mr. Wright let us figure things out ourselves and trusted that, without his guidance, we’d have to get creative. At some point, a student taped a sign above the door that said “Beware of the Wrath of Fred Wright”—a tongue-in-cheek nod to his laissez-faire oversight of the computer room. Some of the other teachers argued for tighter regulations, worried about what we might be doing in there unsupervised. But even though Mr. Wright occasionally popped in to break up a squabble or listen as someone explained their latest program, for the most part he defended our autonomy.
Officially, he was the adult sponsor of our work at Lakeside. Unofficially, Mr. Wright gave us something invaluable: the space to discover our own potential. That was also his approach to geometry class, where I was his student in tenth grade. I remember him watching with amusement as I powered through problems using algebra instead of geometry. Rather than force me to do it the right way, he let me forge my own path, knowing I’d eventually figure out the more efficient (geometric) solution.
Daniel Morris
Dr. Daniel Morris was different from most high school science teachers. With a PhD from Yale and a patent for isolating tryptophan, he was a former industrial chemist who brought real-world expertise to our chemistry classroom. Some might have found it pretentious that he wore a lab coat and drank coffee from a glass beaker, but he earned those rights. I think he also earned the label that I’ve long used to describe him: the world’s greatest chemistry teacher.
What made Dr. Morris so memorable was his ability to transform the rote memorization that most people associate with chemistry into unifying concepts that explain the world around us. He demystified complex processes by using everyday examples—to teach, for example, why soda stays fizzy if you put the cap back on, or what makes super glue that sticky. The introduction he wrote to his own chemistry textbook captures his teaching style perfectly: “We seem to forget the true foundation stone of science: the belief that the world makes sense.”
Before him, the sciences were subjects I did well in analytically but didn’t much care to practically understand or apply. That wasn’t good enough for Dr. Morris, who gave me a hard time for just getting by with what I already knew. Instead, he forced me into the lab to do experiments; to this day, I trace my love of science back to the demands he put on me to really get chemistry. He’s the reason I decided to take organic chemistry at Harvard—even though the class was mostly pre-med students, and I had no plans to become a doctor. (I got a C, my lowest grade in college, but I don’t think I ever told him.)
Tom Cheatham
Looking back on my time at Harvard, I’m grateful for Professor Tom Cheatham’s hands-off approach to some of the most hands-on learning I’ve ever done. As director of the Aiken Computation Lab, he made an extraordinary exception by granting me access to the school’s PDP-10 computer—a privilege typically reserved for graduate students and other professors. Back then, Harvard didn’t even have an undergraduate computer science major.
When we first met, I was an overconfident freshman, practically jumping out of my chair as I pitched him on all my ideas; I remember him taking drags on his Parliament cigarettes as I spoke, seeming pretty uninterested. I later learned that administrative tasks—signing students’ study cards and managing the day-to-day of the lab—were Cheatham’s least favorite parts of his job. Having come to Harvard after years working in industry and government, he was a programmer at heart, designing new computer languages when he wasn’t off meeting with the Department of Defense and securing more funding for the lab.
But he must have seen (and liked) something in me—either my technical experience, my teenage enthusiasm, or both. In my sophomore year, he made another exception and agreed to be my advisor for an engineering independent study to write a computerized baseball game. While I regret that we never formed a closer relationship, Cheatham was clearly in my corner. I knew that then and was reminded of it again recently, when I saw my old college records and learned how he’d defended me when I got in trouble for bringing friends into the lab without permission: It would be a “travesty of justice” if I were forced to withdraw from Harvard, Cheatham told the university’s Administrative Board, adding that he “would be delighted to have BG computing at the Center next year.”
I don’t think I ever properly thanked any of my teachers, including Professor Cheatham, for seeing something in me that I didn’t always see in myself. So many of them passed away before I had the chance. But I am who I am today because of their influence. So in Source Code, I’m sharing their stories and giving credit where it’s due. After all, one brilliant teacher, one mind-blowing class, is enough to change a person’s life. I’m so lucky and grateful to have had many.
Proving Ground
The space race inspired my first video game_
I decided to try making my own version of Lunar Lander.

I loved how the computer forced me to think. It was completely unforgiving anytime I showed mental sloppiness. It demanded that I be logically consistent and pay attention to details. One misplaced comma or semicolon and the thing would crash.
It felt like solving mathematical proofs. Programming doesn’t require math skills (beyond the basics), but it does demand the same kind of rigorous logical approach to problem-solving. In both math and programming, I liked the process of breaking problems down into smaller, more manageable parts. And like solving a problem in algebra, there are different ways to write programs that work—some more elegant and efficient than others — but infinite ways to make a program that crashes. And mine crashed all the time.
I had to solve how a player moved the lander left and right, up and down, how much fuel it had, how fast it burned. I also had to describe what it looked like and how to display the ship in dashes and asterisks on the screen.
Unfortunately, I don’t have the code I wrote back then, but below you can play a text-only Lunar Lander based on the one written by Jim Storer in 1969—the same game that inspired me to write my own.
The Problem
You’re 120 miles above the surface of the moon, and your automated landing system has failed! You’re now in freefall and must take manual control to land safely within two minutes.
To avoid crashing, slow your descent by firing your engines. But use your fuel wisely: You only have 16,000 pounds, and if you run out before landing, you could crash.
Safely touch down a lunar lander on the moon without crashing and before you run out of fuel.
Terminal velocity
How I wrote my first code using a Teletype
It was ancient by today's standards, but cool at the time.
