A Blueprint for Your Digital Afterlife

Cemetary
Chris Whitehead | Cultura Travel | Getty Images

We all know that we're going to die someday. But what happens to our digital life after we're gone?

A few months ago, a friend's mother suddenly passed away. Her iPhone 5s was password protected, but no one knew the code. She had recently visited my friend and his family and used the iPhone to take several pictures with family members. Sadly, these are some of the last photos my friend has of his mother, but they're all stuck on her iPhone.

Since then, my friend has been working with Apple to try to gain access to the photos. As the representative of his mother's estate, he thought the process would be straightforward, but it is proving to be anything but.

More from Recode:
TrackR vs. Tile: The Lost-and-Found Face-Off
How Other Smartwatches Stack Up to Apple Watch
Google Cardboard: Virtual Reality Sets Sights on the Mainstream

This situation got me wondering about my own digital afterlife. What would happen to the tens of thousands of photos, documents and emails I've stored on devices or cloud services?

This week, I dug into this morbid topic with Apple, Google, Facebook and Twitter to get some answers. I'm embarrassed to admit that, for the most part, I didn't realize I had so many options for directing my digital data to someone else if something were to happen. This guide will help you and your friends and family feel more in control, despite the inevitable.

Apple

Apple has nothing in place that lets you predesignate someone to inherit your digital data.

Generally speaking, Apple's privacy policies are strict, protecting both the data of the deceased and the data from other people that may reside on their device or account. The company handles these situations on a case-by-case basis, but you can start by calling Apple's customer support number: 1-800-275-2273.

Apple was relatively vague about how the data retrieval process goes, because each case is different. But I asked about three scenarios that might be common.

Read MoreCIA wants to crack Apple security: Report

If you want to get Apple to remotely wipe a device, like an iPhone or iPad, so it can be used again by someone else, you'll likely need a death certificate and a document officially naming you as executor of the estate for the person who died.

If the deceased stored data only on a device, and that device is running iOS 8.0 or later with a passcode, it's encrypted in such a way that even Apple can't access it. If you want access to content that's backed up in iCloud, like photos, this usually involves a court order. (My friend whose mother recently died is at this stage now.)

Google

When it comes to your digital afterlife, Google offers options related to accounts rather than options around your Android device. Accessible accounts include Google Calendar, Mail, Drive, Contacts and Blogger, among others.

If you'd like to assign someone access to your digital data on a Google account before you die, follow this link to designate that person as the Inactive Account Manager, or IAM. The IAM gets access to your data after you die, but can't edit that content or act as if the account is his or her own account. He or she couldn't send emails from your Gmail address, for example. Google knows that the person is deceased when someone fills out this form, which requires documentation.

Read MoreGoogle search change could cause 'mobilegeddon'

If you'd rather just delete all of your Google account data after a certain time period rather than granting access to someone else, you can do that, too. Start here to select your preferred time frame of inactivity (three, six, nine or 12 months), after which the account will be permanently wiped out.

Since many people die without designating an IAM, people can request access to an account or request to simply close someone's account if they follow the steps at this link. Various documents are required, depending on what you're trying to do.

Facebook

In February, Facebook introduced a feature that lets you designate someone as a legacy contact before you die. To do this, open Facebook Settings, choose Security, and then select Legacy Contact at the bottom of the page. You'll have the option to have a message sent to this person after you die, and you can opt to give the legacy contact permission to download an archive of your Facebook photos, posts and profile information.

This person can manage certain functions, but wouldn't operate the account as if he or she were you. For example, if I designated my husband as my legacy contact, he could pin a post at the top of my Facebook page, like information about my memorial service; he could also change my cover photo and profile picture and accept new friend requests.

Read MoreUber taps Facebook exec as first security chief

Your legacy contact must already be friends with you before you die. He or she will be notified when you die, and will receive instructions that enable managing the deceased person's account.

If you'd prefer not to have your page memorialized or managed by a legacy contact, you can have your account permanently deleted after you die. Choose this setting under Settings, Security, Legacy Contact.

If your friend or family member dies, you can follow this link to ask Facebook to memorialize the deceased's Facebook page indefinitely. This means it remains viewable, but not managed by anyone.

Twitter

If you die, no one else can access your Twitter account, acting as if he or she is you, period.

But if someone you know dies, you can ask Twitter to remove the deceased's account by following the instructions here. After you submit your request, Twitter will email you with instructions for providing more information, including details about the person who died, a copy of your ID and a copy of the deceased's death certificate.

Read MoreCramer Remix: Can Twitter keep climbing?

In certain circumstances, Twitter can remove images or video of people who died — especially related to critical injuries or moments before or after death. Immediate family members and other people who are authorized can make this request using Twitter's privacy form found here.

No one likes to think about dying, but thinking about your digital legacy now might relieve some of the burden on your loved ones when you pass away.

By Katherine Boehret , Re/code.net.

CNBC's parent NBC Universal is an investor in Re/code's parent Revere Digital, and the companies have a content-sharing arrangement.