What is Asset Hosting all about?
CodePen PRO accounts offer asset hosting. In other words, you can upload files directly to CodePen to use in the Pens that you build. For example, host an image file to use in a demo. Rather than the awkward steps of finding somewhere else to host those images for you, you can now just drag a file right onto CodePen to upload it, we’ll host it for you, and you can use it anywhere you like.
This makes working in CodePen even easier and even more fun!
In May 2020 we released a major upgrade to Asset Hosting! The blog post might be fun to look at to see little examples of all the things it can do.
Upload files right from the editor
It’s fast and easy. Just open the Assets panel, then drag and drop a file (or files) onto that area. They will upload and then slide down into the appropriate area based on their type. Click on them to get the URL to where they are hosted. You can use that as a
src for an image, as an external resource, or anywhere else you need to link up a file.
The Asset Manager
We give you full control and management of all your Assets on CodePen, via the Asset Manager. You can access the asset manager from your user menu, or go right to /assets/.
From inside the Asset Manager, you can:
- Upload Assets (drag and drop, or file select)
- Preview image assets
- Delete Assets
- Duplicate Assets
- Rename Assets
- Search/Sort/Filter Assets
- Download Assets
- See how much storage space you have left for uploading
What kind of files can I upload?
Are there any disallowed files?
All uploaded files must adhere to our Terms of Service. Nothing that would violate copyright in the way you are using it. Nothing offensive. We also ban
.exe files as they can be quite nefarious and there is no practical use of those on the web anyway.
Can the Assets be served over HTTPS?
Yep. Your hosted assets are HTTPS by default, and you should probably use them that way. You can always use an HTTPS asset on an HTTP page, it’s just the other way around that is bad news.
How much storage space do I have?
|Per File Limit||Total Storage|
|Free||None (upgrade!)||None (upgrade!)|
|Starter PRO||5 MB||2 GB|
|Developer PRO||10 MB||10 GB|
|Super PRO||15 MB||20 GB|
Can I upload multiple files at once?
Yep! You can select or drag & drop multiple files onto our file picker. In the Asset Panel in the editors, the files will just upload straight away. In the Asset Manager, you’ll see a file list first, allowing you to add more, remove some, or edit the files before uploading.
What happens if I run out of space?
You won’t be able to upload any more files. You can always delete some files to make room. Or if you are a Starter or Developer PRO, you can always upgrade tiers. Super PRO is the highest tier with the most storage space and largest allowed per-file sizes.
Is there a bandwidth limit?
What happens when I upload the same resource again?
If you upload a file that has the exact same name as a file that is already there, we’ll append a number to the end of the file name. For instance:
How are these cached?
We set proper
cache-control headers on your assets to help show any updates if you edit an asset or delete & upload a new file with the same name.
Occasionally you may still see the old version of a file. The best way to combat that browser cache is to change the file name to something the browser hasn’t seen before. You can do that by renaming the file itself, or by appending a query string (
Can I edit files I’ve already uploaded?
You can! Click the edit button next to text-based files and images to open up the great editing experiences.
Editing Text Files
Edit your text assets using the same code editing experience you know & love! You can even edit Assets right within the Pen Editor:
Editing & Optimizing Images
Resize, rotate, and adjust quality in the new image editor without changing the original image! Make your tweaks then save as a new image or copy the optimized URL to get a dynamic served version of your image.
Available URL Parameters for Image Assets
You can manually add these URL parameters to your CodePen hosted images, or use the image editor to get great visual of the available URL parameters. The parameters can always be adjusted later in your code.
|Number||Desired width of the image|
|Number||Desired height of the image|
|Control how the image fits into the given |
|Direction to rotate the image|
|Automatically convert the JPG, GIF and PNG images to WebP if the browser supports it, otherwise the original format is returned.|
|Number from ||Adjust the quality to get a smaller filesize through lossy compression. This setting only applies to JPEG, GIF, and WebP images.|
Examples of the Image Asset URL Parameters
I’m getting a CORS error
CORS is tricky stuff sometimes. The errors can be intermittent. Caching is involved. Browsers do things differently. Seemingly correct headers can not work as expected. But good news! We do everything we can to make sure your assets are set with wide-open permissive CORS headers.
- Your best bet is to make sure you’re using our new URL format, the one that starts with
- If you’re using the older
s3-us-west-amazonaws.com(or even older formats), we still try to set permissive CORS headers, but it’s tricky, so see #1.
Note that you may need to handle CORS directly in your code, with things like the
crossorigin attribute or