Next.js SDK
Last updated: Feb-26-2026
The Cloudinary Next.js SDK provides simple, yet comprehensive image and video rendering, transformation, optimization, and delivery capabilities that you can implement using code that integrates seamlessly with your existing Next.js application.
How would you like to learn?
| Resource | Description |
|---|---|
| Next.js quick start | Get up and running in five minutes with a walk through of installation, configuration, upload, rendering, and transformations. |
| Video tutorials | Watch tutorials relevant to your use cases, from getting started with the Next.js SDK, to rendering and transforming your images and videos. |
| Sample projects | Explore sample projects to see how to implement Cloudinary functionality such as rendering and delivery with transformations. |
| Next Cloudinary GitHub repo | Explore the source code and see the CHANGELOG for details on all new features and fixes from previous versions. |
Install
Install the next-cloudinary package using the NPM package manager:
Configure
Set required configuration parameters
Add your Cloudinary cloud name to your environment variables:
Set additional configuration parameters
In addition to the required configuration parameters, you can define a number of optional environment variables if relevant:
- You need to set the API key and secret if using the Cloudinary Upload Widget for signed uploads.
- You can share the API key publicly, but you must keep the API secret private and use it only on the server.
- For more information about the secure distribution and private CDN options, see Configuration parameters.
Configuration video tutorials
The following tutorials can help you install and set up your SDK:
See more Next.js video tutorials.
Use
Once you've installed and configured the Next.js SDK, you can use it for:
-
Rendering and transforming images - Render your images with transformations applied, using the
CldImagecomponent. See examples -
Rendering and transforming videos - Render your videos with transformations applied, using the
CldVideoPlayercomponent. See example - Uploading assets - Use the upload components to easily add upload functionality to your application. See example
-
Generating social media cards - Create Open Graph images and social media cards with the
CldOgImagecomponent. See example
Quick examples: Image transformations
Here are two quick examples to get you started with image transformations:
- Image transformation example 1 - Apply a sepia effect to an image
- Image transformation example 2 - Apply multiple transformations
Image transformation example 1
The following Next.js code renders the front_face.jpg image with a sepia effect applied:
This code creates the HTML required to render the following transformation URL:
c_limit,w_1080/f_auto/q_auto, are automatically applied by the Next.js SDK.Image transformation example 2
You can apply more than one transformation at a time to give more interesting results:
This code performs all of the following on the original front_face.jpg image before delivering it:
- Crop to a 150x150 thumbnail using face-detection gravity to automatically determine the location for the crop
- Round the corners with a 20 pixel radius
- Apply a sepia effect
- Overlay the Cloudinary logo on the southeast corner of the image (with a slight offset). Scale the logo overlay down to a 50 pixel width, with increased brightness and partial transparency (opacity = 60%).
- Rotate the resulting image (including the overlay) by 10 degrees
And here's the URL that's automatically generated and rendered from the above code:
c_limit,w_384/f_auto/q_auto, are automatically applied by the Next.js SDK.- Read the image transformation guide to learn about the different ways to transform your images.
- See more examples of image transformations using the Cloudinary Next.js SDK.
- See all possible transformations in the Transformation URL API reference.
Quick example: Video transformations
Here's an example to get you started with video transformations using the CldVideoPlayer component.
The following Next.js code renders the ship.mp4 video with the Cloudinary Video Player and transformations applied:
This code performs the following transformations on the video:
- Crop to a 1:1 aspect ratio (square) with a width of 300 pixels, using automatic gravity to determine the focal point
- Apply a blur effect with strength 50
- Apply maximum rounding to create a circular video
- See the Next.js video transformations guide for all available props and examples.
- See all possible transformations in the Transformation URL API reference.
Uploading assets
The Next.js SDK provides two components for uploading assets, CldUploadButton and CldUploadWidget.
CldUploadButton
A drop-in button component that opens the Cloudinary Upload Widget:
CldUploadWidget
A customizable upload widget component:
- See the Next.js image and video upload guide for all available props and examples, including information on signed uploads for secure uploading.
Social media cards
Generate Open Graph images and social media cards with the CldOgImage component:
- See the Social media cards with CldOgImage section in the image transformations guide for detailed examples and configuration options.
- Learn about Open Graph protocol for social media sharing.
Helper methods
In addition to components, the Next.js SDK provides helper methods for generating Cloudinary URLs:
getCldImageUrl
Generate a Cloudinary image URL using the same API as CldImage:
getCldOgImageUrl
Generate a Cloudinary URL specifically for OG Images or Social Media Cards:
getCldVideoUrl
Generate a Cloudinary video URL:
Next.js App Router
The Next.js SDK fully supports the App Router introduced in Next.js 13. When using components in the App Router, make sure to add the 'use client' directive at the top of your file:
Sample projects
Take a look at the Next.js sample projects page to help you get started integrating Cloudinary into your Next.js application.
- Try out the Next.js SDK using the quick start.
- See examples of powerful image and video transformations using Next.js code, and see our image transformation and video transformation docs.
- For information about uploading images and videos from a Next.js application, see Next.js image and video upload.
- Explore the GitHub repository, Changelog, and NPM package.
- Stay tuned for updates by following the Release Notes and the Cloudinary Blog.