Updated date:

How to Write Ragtime Music on the Piano


JohnMello is a writer, composer, musician and the author of books for children and adults.

Ever wanted to write your own ragtime music for the piano? Stuck for ideas about how to get started?

It can be tricky to write piano music of any kind when you have to start from scratch. Instead, why not base your composition on an existing melody? Work your way through this article and you'll see exactly how you might go about it.

Although the examples used are specifically for piano - or keyboard - you can follow the same process to write ragtime music for any instrument you choose.

What is Ragtime?

Ragtime is a style of music that makes use of off-beat or syncopated rhythms, giving it a "ragged" feeling. Scott Joplin is the most well-known ragtime composer. As a genre it flourished during the late 1800s and early 1900s.

Writing Ragtime Piano Music: Step 1

To get started, you need a melody. Rather than make up my own, I've taken the first four notes from Scott Joplin's "The Entertainer" to give me something to work with.

You can see these four notes in the first bar of music below. To create the second bar I simply repeated the same pattern four notes higher. Whenever you repeat a pattern at a different pitch like this it's called a sequence.

These two bars together give me the beginnings of an original ragtime tune. I'm keen to add the left hand as well, and I want it to stand out from the melody, to act as accompaniment without getting in the way of the tune. I did this by using basic 3-note chords or triads which I decided to play staccato and in various inversions. It's important that the two hands are different to give the piece variety and depth.

Ragtime bars 1 and 2

Ragtime bars 1 and 2

You'll notice the instruction "Swing it!" at the beginning of the piece. This tells the perfomer to add a jazzy lilt to the music rather than playing the notes in strict time.

What is Swing?

Swing comes from the phrase "swing feel" where performers put the emphasis on the off-beat in popular jazz music. Swing was popular in the 1930s when "swing" bands were all the rage.

Writing Ragtime Piano Music: Step 2

As you probably know, music is an organic art form. Once you start using an idea, it's best to let the music grow out of that idea and lead you where it may. That's what Beethoven and Mozart did so well.

Because the first two bars used a rising pattern, I decided to make bar 3 go in the opposite direction. You can see that the melody in bar 4 is simply a slight variation on the opening phrases, helping to take the tune to the dominant key of G.

Ragtime bars 3 and 4

Ragtime bars 3 and 4

Writing Ragtime Piano Music: Step 3

The next part of the process involves repetition. Unlike a piece of artwork or a book, most people reference music by listening to it. That means that certain phrases and ideas need to be repeated, giving them something to relate to. Hearing an idea or phrase for the second time helps them get familiar with the music and also enables them to recognize what's happening more easily.

The first two bars of the piece are repeated exactly in bars 5 and 6. Bar 7 is the same as the first half of bar 3, played twice, while bar 8 is altered to add variety and provide a stopping place or cadence. This is at the end of the first section which makes a good place to come to rest temporarily. You'll also notice that the music ends up back in the original key of C again.

Ragtime bars 7 and 8

Ragtime bars 7 and 8

Writing Ragtime Piano Music: Step 4

Now the music moves into the subdominant key of F. This provides a change of tonality and that all-important variety mentioned above. It also gives listeners something new to enjoy - too much repetition will simply make the piece sound boring.

In this middle section the rhythm is the same as in the opening melody, but this time the notes are different, revolving around the note C. Keeping the same rhythm in a new tune is one way to establish continuity.

In bars 9 and 10 this "new tune" is expanded to revolve around the note D and take us gradually to land in the dominant key of G. This announces the end of the middle section and sets us up ready to hear the final portion of the piece.

Ragtime bars 9 and 10

Ragtime bars 9 and 10

Ragtime bars 11 and 12

Ragtime bars 11 and 12

Writing Ragtime Piano Music: Step 5

The piece ends as it began, reminding listeners about the opening theme. The first four bars are repeated exactly in bars 13, 14, 15 and 16. Then we hear bars 1 and 2 for the last time before a brand new tune enters the mix, played by the right hand only.

To bring things to a satisfactory close, both hands play a short melodic fragment based on the original rhythm of the opening melody, the right hand moving up, and the left hand moving down.

Ragtime final two bars

Ragtime final two bars

Example of Ragtime Piano Music

You can see and print the whole tune - which is called "Extended Rag" - by following this link to the piece on Score Exchange:


You can also hear me play the piece in the accompanying video above.

Ragtime Music Quiz

For each question, choose the best answer. The answer key is below.

  1. The word "ragtime" refers to:
    • A type of laid-back swing music
    • Music written on a piece of cloth
    • No one really knows
  2. Where do most pieces of music begin and end?
    • In the tonic key
    • In the dominant key
    • In the listener's mind
  3. Swing music is played:
    • With an off-beat rhythm
    • Syncopated
    • With a more casual feel than classical music
    • All of the above
  4. What do you call the sections in which music is broken up?
    • Chunks
    • Blocks
    • Bars
  5. Scott Joplin wrote music mainly for:
    • The harpsichord
    • The piano
    • Birthdays and weddings
  6. What two things are crucial to help listeners follow the music?
    • Dynamic markings
    • Variety and repetition
    • Chords and melody
  7. A musical phrase repeated at a different pitch is called:
    • An echo
    • Repetition
    • A sequence
  8. When writing piano music, variety can be achieved by:
    • Repeating sections with a slight change
    • Using different techniques in the two hands, such as staccato and legato
    • Keeping the rhythm but changing the tune
    • All of the above

Answer Key

  1. A type of laid-back swing music
  2. In the tonic key
  3. All of the above
  4. Bars
  5. The piano
  6. Variety and repetition
  7. A sequence
  8. All of the above


Charlotte on July 03, 2020:

I have just come across this article and would like to point out that ragtime is emphatically NEVER swung. It goes against the whole point of the style and so I find your emphasis on this as being a key trait of ragtime music very misleading. If you listen to any rag or look at the score for any rag piece you will never see the marking telling you to play with a swung rhythm. The only time you would see such a thing is in those rather naff arrangements of non-rag tunes into 'rag'-style pieces.

JohnMello on February 05, 2018:

Hi David

Thanks for your observations. I think there are probably a lot of parallels between Joplin's music and what we might call traditional classical music. He also has links with blues and jazz too, of course. Who knows? Somebody might come along and write a brand new type of ragtime that people will be talking about in the future.

If you do find any research that makes the kind of connections you mention, do please let us know.

David Jordan on February 05, 2018:

I have loved playing ragtime since I was a beginning student, but why someone would want to compose it today is a bit strange to me. However, I think I can add to the discussion if someone really wanted to do it.

First, there is an interesting work that Joplin wrote called "School of Ragtime" in which he goes through almost all the standard ragtime rhthyms and how he envisioned they should be played. One point I think that is often missed is that it isn't just the syncopation that gives the effect but also where the RH is accented on top of the regular "oom-pa" of the left that gives the effect.

Second, there are also characteristic harmonic devices in ragtime. 2 of the most common are: the heavy use of the secondary dominant going back 3 or even 4 changes and extensively using diminished 7ths as transition chords. Also the octave and 6th intervals are used quite frequently as well.

Finally, it would be well to study the rags to see how the motifs are developed and for the broad structures as well. Like the author pointed out, the second section always changes keys, sometimes twice, before the final reprise. It is obvious looking at his work that he intended ragtime to at least partially mirror classical tradition (he even wrote an opera); and I have wondered if a "rag" has parallels with a sonata in terms of how they are developed but I have never taken the time to verify this. If anyone does a study like this, I would be interested to see the results.

I hope these observations might be helpful to anyone trying to compose ragtime.

JohnMello (author) from England on December 30, 2015:

Thanks for the comprehensive comment Antonio Martinez1! Glad you liked my article :)

Antonio Martinez from Kearny, New Jersey on December 29, 2015:

An astonishing account of how to write ragtime music. As a composer myself, I can say without a doubt that writing for ragtime is one of the most enjoyable form of music to write, particularly because of the repetition and the structure that goes with writing a ragtime piece. I remember Christmas 13 years ago that I got a book of Scott Joplin's Rags and, at first, I never really understood much about American music (most of my interests related to classical music).

However, after playing a few Joplin rags (notably Elite Syncopations, The Sycamore and Kismet Rag), it would be something of a blessing. More recently, as a native New Jersey resident, one of the three pioneers of ragtime was born in Montclair: Joseph Lamb and his background also became an inspiration for me to continue ragtime and its continuing revival.

I am proud to say that during 2015, I wrote 14 more (of my 22) ragtime pieces, drawing inspiration from ragtime but also from classical music and doing so in rather unorthodox ways. I hope to continue to venture into ragtime while also drawing inspiration not only from the great ragtime composers such as Joplin, Lamb and James Scott but also from this guide.

Thanks for a great article and perhaps one day I would love to listen to your ragtime pieces.

Related Articles