> Markdown version of https://opspane.dev/kubernetes/secret-decoder/ for AI agents and readers: the same text, without navigation or the interactive tool.
>
> The tool computes its result with JavaScript in the browser, so this file holds the reference text, worked examples and FAQ. Open the page to run it on your own input.
>
> The Kubernetes Secret decoder takes no input from the URL on purpose: a Secret is pasted into the page and decoded in the tab, never sent anywhere. Values are base64 per the data field; the page explains stringData and binary values.

# Kubernetes Secret Decoder

Decode every value in a Kubernetes Secret from pasted YAML and encode data back into a manifest. Nothing leaves your browser.

## Quick answer

- Values under `data` are base64-encoded, not encrypted: there is no key, and `cGFzc3dvcmQ=` decodes to `password` with `base64 -d`.
- `stringData` is plaintext and write-only: the API server merges it into `data` and never returns it on a GET.
- By default Secrets are stored unencrypted in etcd. Protection needs encryption at rest and tight RBAC, since anyone who can create a Pod in a namespace can read its Secrets.

## How to use

1. Paste a Secret manifest — the output of `kubectl get secret -o yaml` works as-is — or click an example chip.
2. Read the decoded values in the results: each row shows the key, the plaintext, whether it came from `data` or `stringData`, and the size in bytes.
3. Use the per-row Copy button for a single value, or Copy manifest for the whole Secret rebuilt as clean YAML with server-side fields removed.

## What a Secret manifest looks like

| Field | Holds | Example |
| --- | --- | --- |
| `data` | base64 values, what the API returns | `password: cGFzc3dvcmQ=` |
| `stringData` | plaintext, write-only, merged into `data` on write | `password: hunter2` |
| `type` | schema hint for consumers | `Opaque`, `kubernetes.io/tls` |
| `metadata.name` | identity inside its namespace | `app-credentials` |

## Decoding by hand

`base64 -d` reverses a value in one command; the tool does the same thing in the tab, plus UTF-8 validation, byte counts and error handling for values that were never valid base64.

```
printf '%s' 'cGFzc3dvcmQ=' | base64 -d
```

## Gotchas this tool checks for

### Base64 is not encryption

The encoding is reversible by anyone with the text — there is no key. Kubernetes documents that Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd), so read access to etcd is read access to every Secret in it.

`base64` an encoding anyone can reverse

The value round-trips both ways with no key: `hunter2` becomes `aHVudGVyMg==` and back — anyone who can read the Secret runs the arrow backwards with `base64 -d`.

### stringData never comes back

A manifest you wrote with `stringData` looks plaintext in your editor, but `kubectl get secret -o yaml` only ever returns `data`. This tool decodes both, so an apply-file and its fetched form read the same here — when you copy the manifest out, stringData is re-encoded into `data` the way the server would.

Starting from a `.env` file instead? The converter builds the Secret exactly as `kubectl create secret generic` with `--from-env-file` would, and turns a Secret back into a `.env` file.

[Convert a .env file to a Secret](https://opspane.dev/kubernetes/env-to-configmap/)

### Anyone who can create a Pod can read your Secrets

The Kubernetes documentation warns that anyone who is authorized to create a Pod in a namespace can use that access to read any Secret in that namespace — for example by mounting it into a container. Keep RBAC minimal, enable encryption at rest, and consider an external store for anything high-value.

## Verification

- Every decoded value is checked against an independent oracle: Node's Buffer base64 (RFC 4648, the same standard kubectl's Go encoder uses) plus hard-coded literals such as `password → cGFzc3dvcmQ=`.
- Round trips are asserted: decode → encode → decode yields identical entries, and server-side fields (`creationTimestamp`, `resourceVersion`) never return.
- The e2e spec proves the privacy claim: typing, examples and copies produce no request carrying input, and `location.search` stays empty.
- Facts in this text come from the official Kubernetes documentation on Secrets — the `configuration/secret` page of kubernetes.io — read 2026-11-07.

## FAQ

### Is it safe to paste a real Secret here?

Yes — decoding runs entirely in this browser tab. The YAML you paste is never sent anywhere: the page loads no analytics script carrying input, writes nothing to the URL and makes no network request while you type. Still, treat the tab like the Secret itself: don't screen-share it and close it when you're done.

### What is the difference between data and stringData?

data holds base64-encoded values — that's what the API server stores and returns. stringData is plaintext and write-only: you may send it when creating or applying a Secret, the server merges it into data, and it never comes back on a GET. This tool decodes data and shows stringData as-is.

### Is base64 encryption?

No. Base64 is an encoding: it uses no key, so anyone holding the value can run it backwards with one command (base64 -d). Kubernetes docs are explicit that Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd). Real protection needs encryption at rest plus tight RBAC.

### Why does a binary value show as base64 instead of text?

The decoded bytes are checked against UTF-8; if they aren't valid text (a DER keystore, a compressed bundle), showing them as a string would corrupt them. The tool keeps the base64, labels the row binary and reports the decoded byte count so you can still copy it losslessly.

### My YAML won't parse — how do I find the error?

The alert names js-yaml's reason and its position as line:column, counted from 1, and the input gets aria-invalid. The most common causes are tabs (YAML forbids them for indentation), an unclosed quote or bracket, and a duplicated mapping key — all reported before anything is decoded.

### How do I encode my own value into a Secret?

Write the plaintext into stringData and let the server do the encoding, or encode it yourself: printf '%s' 'my-value' | base64 | tr -d '\n'. Don't echo — that would encode the trailing newline too. The tool's Copy manifest button produces correctly encoded data from whatever you decoded.

## Related tools

- [.env to ConfigMap & Secret Converter](https://opspane.dev/kubernetes/env-to-configmap/): Turn a .env file into the exact ConfigMap or Secret kubectl creates from it, with the same quotes, keys and errors, or a manifest back into .env.
- [EKS Max Pods Calculator](https://opspane.dev/kubernetes/eks-max-pods/): Calculate max pods per node for every EC2 instance type, with prefix delegation and the IP addresses your pod CIDR must hold.
- [Kubernetes CronJob Generator](https://opspane.dev/cron/kubernetes/): Generate a complete CronJob manifest with schedule, timeZone, concurrencyPolicy and history limits, explained field by field.
- [Cron Expression Explainer](https://opspane.dev/cron/explainer/): Understand any cron expression in plain English, with timezone-aware next run times and warnings for schedules that never fire.
