Delete objects
Last updated Apr 30, 2026 You can delete objects from R2 using the dashboard, Workers API, S3 API, or command-line tools. To empty or delete an entire bucket, refer to Delete buckets.
Delete via dashboard
- In the Cloudflare dashboard, go to the R2 object storage page. Go to Overview ↗
- Select your bucket.
- (Optional) Select the View prefixes as directories checkbox to view prefixes grouped as folders.
- Select the objects or folders you want to delete. You can select a mix of both in the same operation.
- Select Delete.
- Confirm your choice in the dialog that appears.
To delete all objects in a bucket at once, refer to Empty a bucket.
Delete via Workers API
Use R2 bindings in Workers to delete objects:
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
await env.MY_BUCKET.delete("image.png");
return new Response("Deleted");
},
} satisfies ExportedHandler<Env>;
For complete documentation, refer to Workers API.
Delete via S3 API
Use S3-compatible SDKs to delete objects. You'll need your account ID and R2 API token.
import { S3Client, DeleteObjectCommand } from "@aws-sdk/client-s3";
const S3 = new S3Client({
region: "auto", // Required by SDK but not used by R2
// Provide your Cloudflare account ID
endpoint: `https://<ACCOUNT_ID>.r2.cloudflarestorage.com`,
// Retrieve your S3 API credentials for your R2 bucket via API tokens (see: https://developers.cloudflare.com/r2/api/tokens)
credentials: {
accessKeyId: '<ACCESS_KEY_ID>',
secretAccessKey: '<SECRET_ACCESS_KEY>',
},
});
await S3.send(
new DeleteObjectCommand({
Bucket: "my-bucket",
Key: "image.png",
}),
);
import boto3
s3 = boto3.client(
service_name="s3",
# Provide your Cloudflare account ID
endpoint_url=f"https://{ACCOUNT_ID}.r2.cloudflarestorage.com",
# Retrieve your S3 API credentials for your R2 bucket via API tokens (see: https://developers.cloudflare.com/r2/api/tokens)
aws_access_key_id=ACCESS_KEY_ID,
aws_secret_access_key=SECRET_ACCESS_KEY,
region_name="auto", # Required by SDK but not used by R2
)
s3.delete_object(Bucket="my-bucket", Key="image.png")
For complete S3 API documentation, refer to S3 API.
Delete via Wrangler
Caution
Deleting objects from a bucket is irreversible.
Use Wrangler to delete objects. Run the r2 object delete command:
wrangler r2 object delete test-bucket/image.png
Related resources
Delete buckets
Empty all objects from a bucket and permanently delete it.
Bucket locks
Protect objects from accidental deletion with retention policies.
Object lifecycles
Automatically expire objects after a specified period.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/r2/objects/delete-objects/#page","headline":"Delete objects","description":"Delete individual objects or folders from an R2 bucket.","url":"https://developers.cloudflare.com/r2/objects/delete-objects/","inLanguage":"en","image":"https://developers.cloudflare.com/r2/objects/delete-objects/og.png?v=0250dd3ac42ad24b","dateModified":"2026-04-30","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Download objects from R2 using the dashboard, Workers API, S3 API, or CLI tools. title: Download objects image: https://developers.cloudflare.com/r2/objects/download-objects/og.png?v=71b42c2af7a95765
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/r2/llms.txt
Use this file to discover all available pages before exploring further.
Docs