Heads up! This blog post hasn't been updated in over 2 years. CodePen is an ever changing place, so if this post references features, you're probably better off checking the docs. Get in touch with support if you have further questions.
Just letting you know we put a cap on the size of Pens at 1MB worth of code. Essentially we measure how much code is in the editors and if it exceeds 1MB we show you a warning and prevent the saving of it.
1MB is a crapload of code, so it’s likely you’ll never run into this problem. The most common situation where this would happen is if you encode a large resource (like an image or video) and put that directly into the editor. You’re free to do that, it’s just subject to the 1MB limit.
We’re not trying to be stingy, it’s a performance thing. At that size, saving gets slow, rendering gets slow, the editors get slow because of all the code it’s trying to syntax highlight… it’s just not a good experience.
If you’re curious about finding out the weight of a bunch of code, this website can do that.