How to Hide Data in a Secret Text File Compartment

how-to-hide-data-in-a-secret-text-file-compartment photo 1

In today’s edition of Stupid Geek Tricks (where we show off little-known tricks to impress your non-geek friends), we’ll learn how to hide data in a text file that can’t be seen by anybody else unless they know the name of the secret compartment.

how-to-hide-data-in-a-secret-text-file-compartment photo 2

Here’s How it Works

Ever since Windows 2000, the NTFS file system in Windows has supported Alternate Data Streams, which allow you to store data “behind” a filename with the use of a stream name. It’s not detectable while browsing the file system, or anywhere within Windows… you can only access it with the “secret key” which is really just the name of the stream.

how-to-hide-data-in-a-secret-text-file-compartment photo 3

You can think of these extra streams as secret compartments within the file that can only be accessed if you know the “secret code,” which in this case is just the name of the stream.

This isn’t a completely secure way to hide data as we’ll illustrate below, but it’s a fun trick to know about in a pinch.

Note: This only works on a drive formatted with NTFS.

Hiding Data in a Secret Compartment

In order to use this feature, you’ll have to open a command prompt and use the following syntax:

notepad SomeFile.txt:SecretWordHere.txt

You can use anything after the colon as a secret word, the key is that there can’t be any spaces between the first filename and the colon.

how-to-hide-data-in-a-secret-text-file-compartment photo 4

If you didn’t specify .txt on the end, Notepad will automatically add it, and ask if you want to create a new file, even if SomeFile.txt already existed, because SecretSquirrel!.txt doesn’t already exist.

how-to-hide-data-in-a-secret-text-file-compartment photo 5

Now you can enter in whatever data you want here and save the file:

how-to-hide-data-in-a-secret-text-file-compartment photo 6

When you look at the file, it will still be the exact same size as before:

how-to-hide-data-in-a-secret-text-file-compartment photo 7

You can even open up the file by double-clicking on it, and add whatever data you want to make the file look normal:

how-to-hide-data-in-a-secret-text-file-compartment photo 8

You can use the command line again to add a second hidden “compartment” with a different name:

how-to-hide-data-in-a-secret-text-file-compartment photo 9

You can add whatever other information to this file that you’d like:

how-to-hide-data-in-a-secret-text-file-compartment photo 10

None of these hidden files will affect the other, or change the main file. Just remember, you have to use the command line to access the hidden data.

Note: Once you create a hidden stream, that stream isn’t exactly part of the file… you can’t copy your file to another location and access the streams over there.

Detecting Files with Streams

Of course these files aren’t completely hidden from everybody, because you can use a small command line application called Streams.exe to detect files that have streams, including the names of the streams.

For instance, in my scenario we’d use the following syntax:

streams.exe SomeFile.txt

how-to-hide-data-in-a-secret-text-file-compartment photo 11

As you can see, the names of the streams are shown, which would allow you to easily access them.

If you’re using Windows 7, you can simply use the /R argument to the DIR command to see the streams:

how-to-hide-data-in-a-secret-text-file-compartment photo 12

Deleting Streams

You can use the same Streams.exe command to delete all streams from a file, although I don’t think you can delete just a single stream. Use the following syntax:

streams.exe -d SomeFile.txt

how-to-hide-data-in-a-secret-text-file-compartment photo 13

As you can see in the screenshot, the streams are now removed from the file.

Adding to Hidden Streams from the Command Line

You can add data to a hidden stream by using a number of commands, or really anything that can pipe input or output and accept the standard FileName:StreamName syntax. For instance, we could use the echo command:

echo “Neat!” > SomeFile.txt:Test

how-to-hide-data-in-a-secret-text-file-compartment photo 14

You can see with the streams command in the example above that we now have a hidden stream on the file.

Reading a Stream From the Command Line

You can read data from the stream by piping data into the more command, using this syntax:

more < FileName:StreamName

In my example the actual command was this:

more < SomeFile.txt:SecretSquirrel!.txt

how-to-hide-data-in-a-secret-text-file-compartment photo 15

As you can see, the secret data that we added is outputted to the console.


Of course, this isn’t a secure way to hide data—for that you should use TrueCrypt. It’s just one of those things that can be fun to use and might come in handy here or there.

Learning is fun, isn’t it?

More stories

How to Hide Cells, Rows, and Columns in Excel

There may be times when you want to hide information in certain cells or hide entire rows or columns in an Excel worksheet. Maybe you have some extra data you reference in other cells that does not need to be visible.

How to Open Multiple Word Documents at Once

If you work on several different documents at a time, Word makes it easy to open multiple documents in different windows at once. It’s as easy as selecting multiple files like you do in Windows Explorer.

How to Sync Photos to Your Apple Watch

First smartphone screens replaced wallet pictures as the way to show off your photos and now you can put your photos right on your wrist. Read on as we show you how to sync your favorite photos to your Apple Watch.

Hybrid Drives

Hybrid drives are a hybridization of traditional mechanical hard drive technology and more modern solid-state drive technology. The drives combine the large storage capacity of a traditional magnetic hard drive with the speed of a solid-state drive. The drives typically contain a 4-24GB solid-state