secret

ˈsiːkrɪt

"Secret" works as both a noun and an adjective in English. As a noun it denotes information deliberately withheld from others; as an adjective it describes something hidden or undisclosed. The right German equivalent depends on the grammatical role and the level of formality.

1. Geheimnis

For the noun 'secret': a piece of information or fact that someone deliberately withholds from others.

Can you keep a secret?
Kannst du ein Geheimnis für dich behalten?

The recipe for their sauce is a well-guarded secret.
Das Rezept für ihre Soße ist ein gut gehütetes Geheimnis.

She kept her plans a secret until the very last moment.
Sie bewahrte ihre Pläne bis zum letzten Augenblick als Geheimnis.

2. geheim

For the adjective 'secret' in formal or official contexts: classified, confidential, not intended for public knowledge.

The two governments conducted secret negotiations for over a year.
Die beiden Regierungen führten über ein Jahr lang geheime Verhandlungen.

He was granted access to secret documents.
Er erhielt Zugang zu geheimen Dokumenten.

3. heimlich

When 'secret' describes furtive behaviour or a covert action, often implying something done on the sly or without permission.

She sneaked a secret glance at his phone.
Sie warf einen heimlichen Blick auf sein Handy.

They had been meeting in secret for months.
Sie hatten sich monatelang heimlich getroffen.

Notes

"Geheim" and "heimlich" are easy to confuse: "geheim" refers to the classified status of information (Geheimdienst = intelligence service), whereas "heimlich" describes furtive or stealthy behaviour (on the sly, behind someone's back). The German equivalent of "top secret" is "streng geheim".