# Sort

---

EmEditor provides powerful and fast sorting functions. Sorting can be done by entire lines or by a specific column in a CSV document. You can also sort horizontally by sorting the cells in a single row. Sorting is [fast](/text-editor-features/large-file-support/optimized-sort/), even on large files.

## Sort types

EmEditor supports sorting by these types of values:

- String (A to Z)
- Numerical
- String length
- Word count
- Date and time
- Occurrence count
- IP address

They can be accessed through the **Sort toolbar** or the **Sort** menu.

![Sort toolbar](/media/2022/11/Screenshot-2022-11-18-120322.webp)

![Sort menu](/media/2022/10/Screenshot-2022-10-31-131754.webp)

## Sort a CSV document

Sorting a CSV document by a column is very simple.

1. Go to CSV mode.
2. If the first row is a heading of column labels, enable headings in [**CSV \> Headings (Freeze Panes) \> Column Heading 1**](/text-editor-features/powerful-csv-tools/freeze-header/).
3. Select a column by clicking on the header above the first row.
4. Select a sort command as shown above.

## Advanced Sort

Opening the **Advanced Sort** dialog (**Sort \> Advanced Sort…**) gives you with more options on sort priority. Let’s say you want to sort by the Date column first, and if two dates are equal, sort by Name. You can do this by creating two entries, with the higher priority sort at the highest position.

![Advanced Sort dialog](/media/2022/10/Screenshot-2022-10-31-132840.webp)

## Sort Columns

The **Sort \> Sort Columns…** function gives you the ability to sort in the horizontal direction. This may be useful if you need to order the column labels.

![Sort Columns dialog](/media/2022/12/Screenshot-2022-12-05-104559.webp)

## Sort options

![Sort options in Customize dialog](/media/2022/10/Screenshot-2022-10-31-133312.webp)

EmEditor provides options to customize how strings and values are treated when sorting, such as ignore case or the locale to use. Stable sort can be enabled if required, or disabled to optimize the sort time.
