Loading converter...

How to Convert Environment Files - Complete Guide

Step 1

Input Environment Configuration

Start by providing your environment configuration in any format. Whether you're working with .env files, JSON configs, YAML, or Kubernetes ConfigMaps, our tool intelligently auto-detects the format:

•
Paste directly: Copy your environment variables from .env, JSON, YAML, or K8s manifest and paste into the editor
•
Upload files: Click "Upload" to select your environment configuration files from your project directory
•
Try the sample: Click "Sample" to load a complete example with common environment variables
•
Auto-detection: The tool automatically recognizes whether you're providing .env, JSON, YAML, or Kubernetes format

Example: Environment Variables (.env format)

Here's what a typical .env file looks like:

DATABASE_URL=postgresql://user:pass@localhost:5432/db
REDIS_HOST=localhost
REDIS_PORT=6379
API_KEY=your-secret-api-key
NODE_ENV=production
Step 2

Select Output Format

Choose your desired output format based on your deployment target. Our converter supports multiple popular formats for different use cases:

•
.env format: Traditional dotenv file format for Node.js, Python, Ruby, and most frameworks
•
JSON: Structured object format perfect for JavaScript configs, API requests, or Docker Compose env_file
•
YAML: Human-readable format for configuration files, CI/CD pipelines, and Ansible playbooks
•
Kubernetes ConfigMap: Deploy non-sensitive configuration to K8s clusters with ready-to-apply manifests
•
Kubernetes Secret: A Secret manifest with each value Base64-encoded, for passwords, API keys and tokens (Base64 hides nothing on its own)

Format Comparison

Choose the right format for your use case:

→.env: Best for local development and 12-factor apps
→JSON: Best for APIs, JavaScript apps, and structured configs
→YAML: Best for CI/CD, Ansible, and human-readable configs
→K8s ConfigMap: Best for non-sensitive container configuration
→K8s Secret: Best for passwords, tokens, and sensitive data
Step 3

Instant Conversion with Smart Detection

The conversion happens in real-time as you type or select a different output format. Our intelligent parser handles all the complexity:

•
Auto-detection: Automatically recognizes input format (.env, JSON, YAML, K8s) without manual selection
•
Real-time conversion: See results instantly as you type or change the output format
•
Value preservation: Values stay text exactly as written (00501, 14.50, long IDs, true), and quotes, # signs, $ and line breaks are escaped for the target format
•
Custom resource names: For Kubernetes outputs, specify your own ConfigMap or Secret name (defaults to "app-config")
•
Base64 encoding: Kubernetes Secrets are automatically base64-encoded as required by K8s

Example: Kubernetes ConfigMap Output

The same variables, now as a Kubernetes ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  DATABASE_URL: postgresql://user:pass@localhost:5432/db
  REDIS_HOST: localhost
  REDIS_PORT: '6379'
  NODE_ENV: production
Step 4

Copy or Download Your Configuration

Once converted, you can easily use the output in your projects. Download as a file or copy to your clipboard with one click:

•
Download as file: Click "Download" to save with the matching extension (.env, .json or .yaml)
•
Copy to clipboard: Click "Copy" to quickly paste into your code editor, terminal, or deployment scripts
•
Use in Docker: Docker Compose env_file reads quoted values like dotenv does; docker run --env-file does not strip quotes, so only use it with files whose values are all bare
•
Deploy to Kubernetes: Apply ConfigMaps and Secrets with kubectl apply -f config.yaml
•
Commit to Git: Store non-sensitive configs in version control (never commit real secrets!)

Quick Usage Examples

How to use the converted files:

# Load .env in Docker
docker run --env-file .env my-app
# Apply Kubernetes ConfigMap
kubectl apply -f app-config.yaml
# Load in Node.js
require('dotenv').config()

Frequently Asked Questions

What can I paste in, and how does it know which format it is?

A .env file (NAME=value lines, with or without export), a JSON object, a YAML map, or a Kubernetes ConfigMap or Secret manifest in YAML or JSON. Input that starts with { is read as JSON, input whose first line is NAME=value is read as .env, and anything else is read as YAML. If something can't be read, the error tells you the line and column.

Will my values change on the way through?

No. Every variable is a piece of text, so 00501 keeps its leading zeros, 14.50 keeps its trailing zero, a 19-digit ID keeps every digit, and true or 2024-01-15 stay text instead of turning into a boolean or a date. In YAML and Kubernetes output, values that a YAML reader would otherwise treat as numbers or booleans are quoted so they stay strings. Nested JSON or YAML is flattened into one name per value, joined with _ (db.host becomes db_host), because an env file can only hold NAME=value pairs.

How are Kubernetes Secrets encoded?

Each value in the Secret's data section is the Base64 of its UTF-8 bytes, which is what kubectl expects, so accented letters and emoji decode correctly. Paste a Secret back in and the values are decoded the same way. Base64 is only an encoding, not encryption: anyone who can read the manifest can read the values, so treat a Secret file like the plain .env it came from.

Is my data sent anywhere?

No. The conversion runs in your browser, and nothing you paste or upload is sent to a server. Still, avoid pasting production secrets into any web page you do not control.

How are quotes, # signs, $ and line breaks handled in .env files?

When reading a .env file, a # after a space starts a comment, but a # inside a quoted value or in the middle of a word (like a URL fragment) is kept. Double-quoted values understand \n and other backslash escapes, single-quoted values are taken literally, and quoted values can run over several lines. When writing a .env file, plain values stay bare and anything with spaces, # or $ is quoted so python-dotenv and Node's dotenv read back exactly what you had; if your loader expands ${NAME} references, turn that off (python-dotenv: interpolate=False).

What's the difference between a ConfigMap and a Secret?

Both hold key-value data your pods can load with envFrom. ConfigMaps are meant for ordinary settings such as URLs and feature flags. Secrets are meant for passwords and tokens: Kubernetes can encrypt them at rest and limit who may read them, but the manifest itself only Base64-encodes the values. The resource name you type is cleaned to a valid Kubernetes name (lowercase letters, digits, - and .) and the output tells you if it changed.