Caffeine
C_8H_10N_4O_2 — a long, layered melody. Eight carbons, four
nitrogens, two oxygens.
Welcome to the AsciiChem playground — where chemistry becomes diagrams, games, music, and learning. Everything interactive teaches the syntax from a different angle.
Three input grammars, one semantic model. Type AsciiChem — the syntax
this site documents — paste a database SMILES, or paste a
molfile (V2000 connection table; its coordinates feed the diagram
directly, making it the highest-fidelity 2D path). Every grammar
parses and renders in your browser: 2D structural diagram, typographic
SVG, presentation MathML (L2 goldens, byte-identical across every
runtime), canonical text, or the asciichem-model wire
JSON. The URL fragment mirrors the editor
(#code=…&lang=…&mode=…), so a playground link is a self-contained
demo you can share.
The SMILES reader takes the honest subset: aromatic rings, charges,
isotopes, ring closures — but chirality (@, @@) and E/Z bond
directions (/, \) raise the corpus-defined error instead of a
wrong structure. Where the subset ends and why:
structures and resolution.
Parsed in your browser byasciichem-ts— the same shared corpus the Ruby reference passes. Nothing you type leaves this page. Diagrams are drawn only from bonds you author or coordinates in the file; a bare formula renders typographically because a formula alone does not determine a structure. The SMILES subset stops short of chirality and E/Z (@, /, \) — those raise an error rather than a wrong structure. The URL fragment mirrors the editor (#code=…&lang=…&mode=…), so a playground link is a self-contained demo.
Test your knowledge of elements, symbols, atomic numbers, and chemistry trivia. 10 random questions, immediate feedback with explanations, streak bonuses. No console needed — play right here.
Test your knowledge of elements, symbols, atomic numbers, and chemistry trivia. 10 questions, immediate feedback, streak bonuses.
Learn AsciiChem syntax by solving real chemistry challenges. Each molecule teaches a different construct — subscripts, charges, isotopes, bonds, reactions, and more. 20 challenges across 5 difficulty tiers.
Press the button to begin the AsciiChem challenge.
Type a formula and press Play. Or click any preset. Each element maps to a musical note based on its atomic number, and each element family has its own waveform.
Each element maps to a musical note via a pentatonic scale — a five-note scale that sounds pleasant in any combination. The atomic number determines the note and octave:
| Element | Atomic # | Note | Waveform | Why |
|---|---|---|---|---|
| H | 1 | C4 | sine+harmonic | Nonmetal — organic, pure |
| He | 2 | D4 | sine | Noble gas — smooth, ethereal |
| Li | 3 | E4 | square | Alkali metal — sharp, reactive |
| C | 6 | A4 | sine+harmonic | Nonmetal — the basis of life |
| N | 7 | C5 | sine+harmonic | Nonmetal — like H, an octave up |
| O | 8 | D5 | sine+harmonic | Nonmetal — bright |
| Ne | 10 | G4 | sine | Noble gas — calm |
| Na | 11 | A4 | square | Alkali — like lithium’s cousin |
| Fe | 26 | E5 | triangle | Transition metal — warm, metallic |
| Au | 79 | D6 | triangle | Transition metal — precious, bright |
Because each family has its own waveform, you can hear the chemistry. A molecule full of noble gases sounds calm and flowing. An alkali-halogen reaction sounds sharp and energetic.
Caffeine
C_8H_10N_4O_2 — a long, layered melody. Eight carbons, four
nitrogens, two oxygens.
Ethanol
C_2H_6O — the sound of a party. Two carbons and an oxygen.
Glucose
C_6H_12O_6 — 24 atoms = a full phrase.
Haber process
N_2 + 3H_2 <=>[Fe] 2NH_3 — nitrogen and hydrogen becoming
ammonia. The melody shifts when it crosses the arrow.
The site responds to AsciiChem syntax typed anywhere. Each trigger fires a themed effect AND shows a discovery card explaining what the syntax means. Experiment to learn:
| Type this… | …to learn this | Effect |
|---|---|---|
H_2O | Subscripts (_2 = ×2) | 🌧️ Rain |
Au | Element symbols (Au = gold) | 🥇 Gold rush |
Ne | Noble gases | 💡 Neon glow |
^14C | Prefix isotopes | ☢️ Discovery card |
Ca^2+ | Charges (number-then-sign) | ⚡ Discovery card |
Fe^(II) | Oxidation states | 🔬 Discovery card |
<=> | Equilibrium arrows | ⚖️ Discovery card |
2H_2 + O_2 | Stoichiometry + reactions | 💥 Explosion |
caffeine | Caffeine formula C_8H_10N_4O_2 | ☕ Hyper focus |
bond | Bond types (- = #) | 🔗 Discovery card |
| Konami code | (just for fun) | 🎉 Party mode |
Open the developer console (F12) and type help() for the full
command list:
help() // Lists ALL commands + syntax triggersasciichem.compose("H_2O") // Play any molecule — shows what atoms are playingasciichem.fact("Au") // Random fact about gold + its toneasciichem.weight("H_2O") // Molecular weight: 18.015 g/molasciichem.sing() // Periodic table melodyasciichem.achievements() // Your badge collection (12 to unlock)asciichem.achievements().The sound engine uses the Web Audio API exclusively — no audio files, no dependencies. Every tone is synthesised live from an oscillator node with an ADSR envelope.
The element → frequency mapping uses a pentatonic scale (C, D, E, G, A) cycling through octaves. This ensures every combination sounds consonant — there are no dissonant intervals in a pentatonic scale.
The waveform per element family:
| Family | Waveform | Character |
|---|---|---|
| Noble gases | sine | Smooth, calm |
| Nonmetals (H, C, N, O) | sine + octave harmonic | Organic, pure |
| Alkali metals | square | Sharp, energetic |
| Alkaline earth | triangle | Warm, steady |
| Halogens | sawtooth | Bright, aggressive |
| Transition metals | triangle | Metallic, warm |
Sound is off by default for new visitors and can be toggled via
the speaker icon in the header. Your preference is saved to
localStorage.