Last updated: December 11, 2019
39 Ways to Learn to Code for Free
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Even if you don't plan to become a developer, you will benefit from being able to code. With basic knowledge and a little practice, you'll be amazed at what you can achieve.
From web development to creating applications, knowing how to code can save you time and money. You can fix your own site, automate tasks, and potentially earn a little cash helping others.
Taking a full development course can be expensive, and when you're just starting out, you don't need to spend. There are plenty of ways to learn to code online for free. All you need to do is choose the language you want to start with.
Learn HTML and CSS
Despite being very straightforward, HTML is perhaps the most useful language to know. Once you get to grips with simple HTML code, you can quickly move on to more advanced languages.
CSS is a separate language that controls the look and feel of the HTML page. The two languages work well together, although it's best to start with HTML and go from there.
- W3Schools CSS Examples: learn to code CSS from these free code snippets that explain how code works.
- W3Schools HTML Examples: W3Schools also provides this excellent beginner's HTML course, which will get you started with basic code.
- Learn to Code HTML and CSS: Shayhowe's detailed beginner's guide offers a structured introduction to HTML and CSS. Learn the principles of good design, understand how the box model works, and start to work with forms and tables.
- Intro to HTML and CSS: this excellent course from the Khan Academy offers lessons in manageable chunks. This course takes absolute beginners through HTML and CSS, in small and very manageable lessons.
- HTML and CSS: the Odin Project presents this HTML and CSS primer as part of a wider web development and design course. This is part 5 in the series; you may want to step back and work through the modules in order if you plan to learn more about web development.
- CSS Cross Country: this beautiful CSS tutorial is ideal for beginners who know a little about HTML already. It will help you to develop your knowledge about the principles behind CSS.
- Learn HTML: HTML.net offers two different HTML courses: start Learning HTML, and Start learning HTML5. The HTML5 course contains the same basic content as the HTML course but is much more comprehensive.
- 150 Cool CSS Examples and Tutorials: tweak these code snippets to figure out how CSS works. You will soon be able to adapt the code and use it for your own web development projects.
- Absolute Beginner's Guide to HTML and CSS: if the rest of the guides in this article look too advanced for you, start right here.
Learning Ruby on Rails
- Code Academy Ruby on Rails: learn to build your own basic web apps in this free course. It takes around 9 hours and is pitched at complete beginners.
- Ruby Primer: this 10-part course teaches all of the key principles in Ruby, from Strings to Lambdas.
- Learn to Build a Ruby on Rails Application: this series of video tutorials takes you through the process of building a web app. It's best for intermediate learners who have experience of working with code.
- Try Ruby: use this clear, engaging introduction to learn how to code in Ruby. There's a handy 15-minute interactive tutorial that gets you started right away, which is the best beginner resource we've found.
- UT On Rails: get access to a free 10-week course, which consists of video lectures and practical exercises.
- Rails for Zombies: start coding with Ruby in your browser, without having to install any software. Rails for Zombies is a hassle-free way to try Ruby.
Learning PHP and SQL
Structured Query Language (SQL) is used to extract information from a database. Many websites rely on a back-end database to store content, so SQL is a valuable skill. PHP and SQL work well together and power many millions of sites on the web.
Fortunately, SQL is easy to learn and very versatile. You only need the basics to start to code your own database queries, and you can adapt what you learn for MySQL.
- Learn SQL: Code Academy strikes again with a great SQL tutorial. It only takes 3 hours to run through and will leave you competent in basic queries.
- Data Boot Camp: this resource will teach you the broader principles of database analysis. It's not particularly interactive, but makes a great beginner's reference guide.
- Learn SQL by Calculating Customer Lifetime Value: this tutorial takes a practical approach to SQL, by posing a problem and using the solution as a lesson. The tutorial is split over two pages and is written in clear, accessible language.
- Beginners' PHP: this huge online PHP tutorial walks through the basics of PHP, with practice exercises and thorough explanations. Work through it to learn how to code in PHP, or bookmark it for quick reference as you improve your skills.
- PHP and MySQL Databases: MySQL is a variation of standard SQL, and it shares many of the same commands. This W3Schools tutorial explains how PHP and MySQL work together.
- PHP/ MySQL Tutorial: despite being a little long-winded, this tutorial offers some useful practical examples.
- Free Interactive PHP Tutorial: this tutorial lets you code live in your browser and instantly run the code to see the results.
- SQLCourse.com: quickly develop your SQL skills with this tutorial, which breaks down the concepts into easily digestible chunks.
- PHP-MySQL Tutorial: this excellent free resource will teach you the basics of PHP, the basics of MySQL, and the techniques you need to know to use them together. It also touches on Zend Optimizer, Pear, and the MySQL GUI.
- 5 Free Ebooks and Tutorials on SQL: this blog from ReadWrite has some useful links for further reading.
Learning how to use the Command Line
If you're working with code, it really helps to be able to use the command line as well as the mouse. Once you learn basic scripts, you can start to build scripts that automate tasks and make repetitive tasks easier to manage.
- Learn the Command Line: this Code Academy tutorial is free, and lasts approximately 3 hours. You'll start by learning how to move around in a directory, and there are regular quizzes to test your knowledge.
- David Baumgold's Command Line Tutorial: this compact guide is designed for novices. It starts right at the beginning and helps you to locate the command line on your computer.
- A Command-Line Primer for Beginners: Lifehacker has put together this excellent tutorial that shows practical ways to use the command line to make life easier.
- Learn the Bash Command Line: learn how to use the Linux command line, Bash, with Ryan Chadwick's 13-part guide.
Python was specifically designed for coding web applications. Python is a great beginner's language because the code is easy to scan, and it contains lots of English words that describe exactly what's going on. If you want to learn just one general-purpose programming language, Python is a great choice.
- Getting Started With Python: a blog post that explains how Python works. Ideal for absolute beginners. Follow the link at the bottom to work through a series of simple tutorials.
- Checkio: learn to code Python in this beautiful online game that teaches using creativity and interactive challenges.
- Basic Python Tutorial: if you prefer to read sequentially through lessons, this collection of references and lessons will have you coding Python fast.
- Python 101: comprehensive course designed for self-study. It helps to have a little knowledge of coding before you begin to work through this guide.
- Pythonspot Tutorials: clearly labelled Python reference guides, starting with beginner examples.
Your Favorite Resources
Taking a class is the best way to learn to code. And there are still more resources if you want to learn something different like C++ or game programming.
But you can also self-study and become relatively proficient. If you have a little time, and you're willing to practice, coding soon becomes second nature.
Do you use a coding resource that we missed? Let us know in the comments.