Apple's Notes app stores local copies of your Notes on your Mac. Here's how to find them.
Apple's Notes app lets you store notes locally and in iCloud. For both types of notes, macOS makes a local copy and stores them for the Notes app to use. Should you need to find these for any reason, or if for some reason you need to recover the thumbnail images for notes, you can do it locally on your Startup Disk.
You might want to do this if you've accidentally deleted a note, or want to recover a cached thumbnail from a note that was deleted long ago. You might also want to use the local files if you want to reinstall macOS, or set up a new Mac, although in the latter case, you're probably better off syncing all the Notes to iCloud and then re-syncing the new Mac to it to download everything.
Trying to move the existing local Notes data over to a new Mac by copying the local files may work, but you may only obtain partial results, and the potential for losing data via this method exists.
To view both local and iCloud notes in the macOS version of the Notes app, first click the sidebar icon in the main window's top left corner to reveal notes in the sidebar, then click the small hidden turnable arrow next to both the "Notes" item under the "iCloud" heading, and the one under "On My Mac".
The small turnable arrow next to both items is hidden until you hover over them, which is a strange violation of Apple's own Human Interface Guidelines.
Once the Notes items are revealed in the sidebar, click on each one to display iCloud or local notes in the main window's right-hand pane.
You can also create new folders by clicking the small New Folder "+" icon in the main window's lower left corner. The new folder gets created under either "iCloud" or "On My Mac" in the sidebar, depending on what the default account is set to in the Notes->Settings window from the main menu.
Notes also allows you to share Notes from other internet services such as Google, Microsoft Exchange, OneNote, Yahoo!, and others.
To add an internet account go to Notes->Accounts from the main menu. This brings up macOS Settings pane, from which you can click the "Add Account" button on the right to add a new internet account.
The Notes User Guide has a page on how to add new accounts to Notes.
For local notes, the Notes app stores everything in:
In this folder you'll find local Notes preferences stored in a subfolder in /Library/Preferences/group.com.apple.notes.plist. Many of the settings in this .plist file are private to Apple and may or may not be modifiable.
Some, but not all cached note thumbnails are also stored in the ~/Library/Group Containers/group.com.apple.notes/ folder, but in a /Thumbnails/Recent folder. A .png and a .json description of the thumbnail are stored here.
Notes removes these thumbnail caches at times it sees fit, but which is undocumented.
A much larger thumbnail cache is also stored in ~/Library/Group Containers/group.com.apple.notes/ but in the /Accounts folder in a folder with a UUID as its name. This folder contains a folder named "Previews", which in turn contains .png files, each named with a unique UUID generated by Notes.
This folder can get quite large and it's not clear the logic Notes uses to empty it when you delete individual notes in the app. To save disk space you may want to go through and manually clean out ancient files that are no longer used.
Also in the same /Accounts subfolder, is a folder entitled "Media". This is where Notes stores any items you may have pasted into your individual notes: large images, videos, links, and other items.
The logic Notes uses for clearing this folder is also not documented by Apple.
There is another subfolder in /Accounts, named "LocalAccount", but oddly not much ever seems to be stored here - local or not. iCloud items and media are never stored here, but to date, we've not seen anything from local individual notes stored here either, no matter how long they've existed.
Also stored in the ~/Library/Group Containers/group.com.apple.notes/ folder is an invisible preferences file named .com.apple.containermanagerd.metadata.plist. To view this file, you'll need to show hidden files in Finder, which we've discussed previously.
This file contains some metadata used by the Notes app - mostly just UUID settings and some POSIX user and group ID info.
The local database
In ~/Library/Group Containers/group.com.apple.notes/ you'll also see several lock files which are used while Notes is running, and which are deleted or unused when it's quit. There are a few other files and folders such as state, database backup files, and temp files. You can ignore most of these.
But the really important file is named "NoteStore.sqlite". This is a local SQLite database file, which stores all the notes and info associated with them. SQLite is an open source standard and the NoteStore.sqlite file can be viewed with any database app which can read .sqlite files.
Easy-to-use free SQLite viewer apps include Liya, DBeaver, and DB Browser for SQLite. If any of your notes are protected by passwords you'll need those passwords to be able to view the databases.
Most of the info in the database file are merely references back to the media on disk, and so it may take some searching to find what you're looking for.
For Notes stored in iCloud, most of the note data is stored on Apple's iCloud servers via the CloudKit framework and API in a remote database. If you have an Apple developer account you can view some of this data via the CloudKit web interface.
When you add a new note to the Notes app under the "iCloud" heading, the Notes app automatically syncs them to iCloud servers via CloudKit (actually the background daemon cloudd does the syncing).
In macOS Ventura, iCloud stores some partially mirrored iCloud Notes data locally in:
But most of the iCloud Notes data gets sent to the iCloud servers.
In ~/Library/Containers/Notes/Data/CloudKit you'll find one or more UUID-named folders, each containing a database and other folders. You'll also find a "cloudd_db" folder. These are mostly local caches of CloudKit databases, records, and indices used to speed up Notes data access, but they may or may not also contain some records.
There are also folders for the Notes Quick Look extension, and Spotlight indexing in the ~/Library/Containers/ folder.
Notes iCloud syncing has been a contentious issue for users for years, and Apple has yet to fully address the issue, although Notes syncing across devices does seem to have improved somewhat in recent years.
The biggest sync problems seem to arise where a huge number of notes are stored in the Notes app, or when one device hasn't been synced in a long time and the synchronization data is far out of date for a particular device.
Also, see William Gallagher's article from a few years back on how to use Quick Notes on macOS Monterey.