Split name into first, middle and last names in Zapier

Using Zapier, here’s a problem you’ll run into a lot: The trigger app provides a person’s full name, and the action app asks for first name and last name separately.

Below you’ll learn the best & easiest way to split a full name into first, last and middle names.

Note that multi-step Zaps require a paid account. Every way to spilt names currently requires a middle step, so unfortunately this is unavoidable.

Most solutions for this use Zapier Formatter. While this is a simple setup, it requires 2 steps in your Zap, which uses up more tasks. They also usually only show how to get the first and last names, leaving everything in the middle out.

This solution uses only 1 step and also splits out the middle name.

The example below shows a Trigger from Content Snare that has returned a full name.

Want to get more productive and automate your business to create more free time? Sign up for my newsletter and I'll send you a guide on the exact tools and systems you can use to save 25+ hours every single month. Click here to get the guide.


  1. Add a step using the + icon after the trigger
  2. Choose the app “Code by Zapier”
  3. Run the Action Event “Run Javascript”

Click continue and set up the action like this:

  1. In the left “input data” box, type “name”
  2. In the right box, add the name from the trigger
  3. In the code box, paste in the code below
var names = input.name.split(' ');
if (names.length > 2) {
  output = [{firstname: names[0], middlenames: names.slice(1, -1).join(' ') , lastname: names[names.length - 1]}]; 
else if (names.length < 2) {
  output = [{firstname: names[0], middlenames: '', lastname: ''}];
else {
  output = [{firstname: names[0], middlenames: '', lastname: names[names.length - 1]}];
split first last names zapier

Then hit continue, then ‘test & review’.

Now, when you create your next action, you should get Firstname, Lastname and Middlenames as options to send.

This all!

If you’d like to learn more Zapier tips, sign up below.

Picture of James Rose

James Rose

James is the co-founder of Content Snare - a software platform that helps professionals collect content & files from clients.

Once an automation engineer, his new priority is to help business owners regain their lives, be more productive and get more done in less time.

Learn how to save 25+ hours every week with automation. Get the guide when you sign up for the productivity newsletter. Click here to get it..