Select Page

How to Memorize Codes: Tips & Tricks

Guil Hernandez
Published: December 21, 2022

One of the most common questions I get from students is: “What’s the best way to retain what I’m learning?”

Students may think they understand the lessons and concepts being taught, but later struggle putting it all into practice. Writing good code takes a lot of time and effort, so the best way to retain the information is through practice and repetition –– easier said than done, right?

To show you how to memorize codes, we’ve compiled some of our best tips and tricks in this guide. Keep reading to learn how you can better retain what you’re learning.


It’s said elephants have great memories. Why can’t we, too, when it comes to remembering code? (Photo by Flickr user Martin Fisch)

How to Memorize Codes: 6 Tips to Help You Retain What You’re Learning

1. Remember to Implement

Often, even when you think you have a good grasp of HTML, CSS, or JavaScript concepts and techniques, they’re difficult to put into practice. And sometimes, no matter how clear the explanations in the videos or tutorials, you can’t get anything to work when you try it later on.

That’s because your interpretation of what’s being taught varies –– you can’t just take the lesson at face value. You need to make sure that your interpretation is right by implementing what you learned.

Take some time to truly practice your newfound coding skills. At Treehouse, our Techdegrees and courses offer coding projects you can complete to implement what you learn. As you practice, you’ll gain a deeper understanding of coding concepts.

Free trial on Treehouse: Do you want to improve your development skills? Click here to try a free trial on Treehouse.

2. Don’t Just Watch or Read

Be an active learner, not a passive learner. It’s difficult to retain information through passive learning. You may think that watching a video or reading a tutorial over and over again is enough to lodge the information in your head forever. While some of it will eventually stick, it’s not the most effective way to learn.

Even though you’re focused on what’s being taught in the lesson, you’re just seeing or reading abstract concepts. To really get it, you need to run into difficulty, make mistakes, then identify and correct them. So converting that knowledge from abstract to practical is important because it’s no longer something someone else has told you.

Start building something right away. For example, try building a single-page website or a small website component. It doesn’t matter what it looks like or how it works. As long as you keep doing it while raising the bar, you’ll gradually get better. I promise!

Related Reading: 5 Simple Ways to Improve Your Coding Skills and Confidence

3. Use Online Coding Tools

These days, online code editors like CodePen, JSFiddle, or Treehouse’s Workspaces provide designers and developers a quick way to communally experiment with code. This is a helpful way of implementing a concept you just learned.

To ensure you’re getting it into your long-term memory, try coding at different times during the day, without looking anything up beforehand.

4. Developer Tools

When visiting websites I like, I always use Chrome DevTools (or Mozilla’s Firefox Developer Tools) to inspect the code and see how certain parts of it were built. I’ve learned some neat things doing that. 

Also, viewing –– or “borrowing” –– another website’s HTML and CSS, then changing it around to build something different can really help when learning to code.

5. Share Your Knowledge

“But I’m not an expert!”

It doesn’t matter. You will always know something that someone else doesn’t know. Plus, you’ll retain more when you synthesize then teach the information. Down the road, it might even establish you as the “expert” in a given topic.

I’m always impressed by those students who have blogs where they write about what they’re learning. It’s no coincidence they are the ones who find successful work in the industry.

Related Reading: How to Start Coding

6. Be Patient & Confident

It’s important to be patient because it takes a while to wrap your head around code, but the more you do it, the more it starts clicking.

Don’t worry about memorizing every tag, selector, property or value available. A solid understanding of the concepts –– and a reliable reference –– is more important. I probably don’t know every CSS selector off the top of my head, but I sure know how they work and where to reference them.

For example, If you asked me to code a five-color-stop radial gradient using the old and new syntax, I’d probably go straight to MDN or use ColorZilla’s Gradient Generator. By knowing exactly how gradients work, the types of syntax and browser support, I’m able to move through the process much faster.

Finally, to retain new concepts, you need to be confident and refrain from being pessimistic when you struggle. Pessimism leads to giving up.

Learn to Code With Treehouse

Treehouse offers Techdegrees and courses covering everything you need to know about coding. Plus, we offer hands-on projects to complete throughout each course so you can gain the skills needed for coding success. Learn how to code today by signing up for a free trial of Treehouse!