Skip to content

Playground

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.

Score0
Streak0 🔥
Correct0/0
🧪

Chemistry Quiz

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.

Score0
Streak0 🔥
Solved0/20
⭐

Click Start!

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.

Press Play to hear the molecule
Metals = triangle Noble gases = sine Halogens = sawtooth Alkali = square

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:

ElementAtomic #NoteWaveformWhy
H1C4sine+harmonicNonmetal — organic, pure
He2D4sineNoble gas — smooth, ethereal
Li3E4squareAlkali metal — sharp, reactive
C6A4sine+harmonicNonmetal — the basis of life
N7C5sine+harmonicNonmetal — like H, an octave up
O8D5sine+harmonicNonmetal — bright
Ne10G4sineNoble gas — calm
Na11A4squareAlkali — like lithium’s cousin
Fe26E5triangleTransition metal — warm, metallic
Au79D6triangleTransition 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 thisEffect
H_2OSubscripts (_2 = ×2)🌧️ Rain
AuElement symbols (Au = gold)🥇 Gold rush
NeNoble gases💡 Neon glow
^14CPrefix isotopes☢️ Discovery card
Ca^2+Charges (number-then-sign)⚡ Discovery card
Fe^(II)Oxidation states🔬 Discovery card
<=>Equilibrium arrows⚖️ Discovery card
2H_2 + O_2Stoichiometry + reactions💥 Explosion
caffeineCaffeine formula C_8H_10N_4O_2☕ Hyper focus
bondBond 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 triggers
asciichem.compose("H_2O") // Play any molecule — shows what atoms are playing
asciichem.fact("Au") // Random fact about gold + its tone
asciichem.weight("H_2O") // Molecular weight: 18.015 g/mol
asciichem.sing() // Periodic table melody
asciichem.achievements() // Your badge collection (12 to unlock)
  • Click any atom in a rendered example to hear its tone.
  • The 🎮 button in the bottom-right corner links here from any page.
  • 12 achievements to unlock — check with 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:

FamilyWaveformCharacter
Noble gasessineSmooth, calm
Nonmetals (H, C, N, O)sine + octave harmonicOrganic, pure
Alkali metalssquareSharp, energetic
Alkaline earthtriangleWarm, steady
HalogenssawtoothBright, aggressive
Transition metalstriangleMetallic, 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.