--- id: 'storage-bucket-public-and-private' title: 'Storage buckets' description: 'Learn how Supabase Storage buckets organize your files, how public and private buckets control access, and which use cases suit each type of Storage bucket.' sidebar_label: 'Buckets' tocVideo: ch2UGHMreB0 --- Knowing the difference between public and private buckets tells you which kind to create for each kind of file. For how to create a bucket, see [Creating buckets](/docs/guides/storage/buckets/creating-buckets). ## Access model Buckets keep your files organized and determine the access model for your assets. There are two access models for buckets, public and private: | Access model | Retrieving and serving files | Other operations | | --------------------------- | ------------------------------------------------------------------------------------------------------ | ----------------------- | | [Private](#private-buckets) | Downloads with the user's JWT are subject to RLS policies. A signed URL gives access until it expires. | Subject to RLS policies | | [Public](#public-buckets) | Anyone with the asset URL | Access control enforced | [Upload restrictions](/docs/guides/storage/buckets/creating-buckets#restricting-uploads) like max file size and allowed content types are also defined at the bucket level. ## Private buckets When a bucket is set to **Private**, all operations are subject to access control via [RLS policies](/docs/guides/storage/security/access-control). This also applies when downloading assets. Buckets are private by default. The only ways to download assets within a private bucket are: - Use the [download method](/docs/reference/javascript/file-buckets-download) by providing an authorization header containing your user's JWT. The RLS policy you create on the `storage.objects` table uses this user to determine if they have access. - Create a signed URL with the [`createSignedUrl` method](/docs/reference/javascript/file-buckets-createsignedurl) that can be accessed for a limited time. The following are example use cases for private buckets: - Uploading users' sensitive documents - Securing private assets by using RLS to set up fine-grain access controls ## Public buckets When a bucket is set to **Public**, anyone with a file's public URL can download it. Storage skips access controls when it serves a file from a public bucket. [Access control is still enforced](#control-access-to-a-public-bucket) for other operations, including uploading, listing, deleting, moving, and copying. The following are example use cases for public buckets: - User profile pictures - User public media - Blog post content Public buckets get a better cache hit rate than private buckets, because they're [cached differently](/docs/guides/storage/cdn/fundamentals#public-vs-private-buckets). ### Control access to a public bucket A public bucket needs no policy for downloads by URL, so don't add a `SELECT` policy to make files readable. A `SELECT` policy that matches the whole bucket, such as `using (bucket_id = 'avatars')`, lets clients list every object in it. Listing, overwrites, moves, copies, and deletes each need a `SELECT` policy. Scope it to the user's own objects with an `owner_id` or folder check. For the permissions each operation needs, see [Access policies](/docs/guides/storage/security/access-control#access-policies). The [Security Advisor](/docs/guides/observability/advisors?lint=0025_public_bucket_allows_listing) flags a public bucket that allows listing. ## Related resources - [Creating buckets](/docs/guides/storage/buckets/creating-buckets): create a bucket and set upload restrictions. - [Storage access control](/docs/guides/storage/security/access-control): write the RLS policies that control file operations in your buckets. - [Storage CDN](/docs/guides/storage/cdn/fundamentals): how public and private buckets are cached.