Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shapefile I made in QGIS 1.7.4. One of the fields is a String of length 80. I'd like to make the field accept longer stings, but I can't figure out how to change its length. How do I do this?


share|improve this question
up vote 8 down vote accepted

Here is a solution which surprised me that it worked!!!

Warning: first make a backup.This is an experiment though it worked for me just now..

open the .dbf of the particular shapefile using OpenOffice Calc application. Change value from 80 to whatever value you want. Please see the image below. Surprising thing is these field definitions were not visible in Excel..Advantage of being Open!!

enter image description here

share|improve this answer
+1 - excellent little trick. Always found those numbers annoying in Libre/Openoffice DBFs but now see the use. – Simbamangu Mar 13 '12 at 17:01
I second this, use it quite a lot for quick and dirty data editing and formating (especially when I want to make use of Cals's formulas), or when I just want to join some data by location and once more the fieldname turns auf to be too long... Just remember: don't re-sort the rows without some FID-column to rearrange them correctly, or every feature will have some wrong attribute data afterwards. – SAnderka Mar 13 '12 at 20:06
I tried this, and it corrupted the values in subsequent columns. It's a clever idea, though. – Evan Mar 13 '12 at 22:34
I have never experienced any data corruption so far. Did you accidentally change data types (C, for example, stands for character, more is explained here: Although Calc does warn you if you try to save a dbf with data in it that doesn't fit the header. I still don't quite understand in which way your data gets corrupted, that could almost mean anything... – SAnderka Mar 14 '12 at 18:08
And about the sorting: The connection between feature data (polygons, points, lines) and the attribute data seems to be made by row number, to if you resort any attribute-file in Calc and save it, wrong attributes will be connected with your features (mixed up, so to say). – SAnderka Mar 14 '12 at 18:11

To my knowledge, you cannot alter the length of shapefile fields in QGIS. Recommend creating a new field:

  • Open attribute table
  • Toggle editing on
  • Select 'New Column' and set
    type to text, and choose the desired width

If there is already data in the old field, use field calculator to populate the new field:

  • Select 'Field Calculator'
  • Tick 'Update existing field' and choose the new field
  • Double-click the old field name under 'Fields'
  • Hit 'OK' and don't forget to save your edits.
share|improve this answer
Good method. At the end of these steps, go into Table Manager (a plugin) to delete the old field, and (if necessary) rename the new field. – IanS Feb 13 at 22:10

I've just done this in Excel. open the dbf in Excel, right click the column header you want to change and select Column Width. Change to the length you need, then save as a dbf. Seemed to work OK for me.

share|improve this answer
isn't column width supposed to be the display width of the column? – vinayan Jun 28 '12 at 15:37
@Vinayan, the question explicitly refers to what the field can hold, not how it is displayed in QGIS. Excel uses display width of columns as a guide to how wide to make the field when it saves the file, which is why this answer works. For details please visit However, it works only in older versions of Excel. The latest will not write DBF files I hear :-(. – whuber Jun 28 '12 at 16:28
@whuber , that is interesting..i would never put that type of functionality(resizing) in my applications :-) – vinayan Jun 28 '12 at 16:42

Guide to changing the column size for the Attribute table in QGIS

  1. Right click on the vector layer and select properties.
  2. Go to the field tab.
  3. Add a new column (This button is in the top right hand corner. a. Make sure to match all the data as the column you are, trying to widen. Except the length change that to your desired length.
  4. Select ‘Field Calculator’ button (This button is in the top right hand corner.)
  5. Check the ‘Update existing field’
  6. Make sure ‘Update selected field only’ is unchecked.
  7. Choose new field from the menu right next to the check boxes
  8. Under the Field Menu double click the old field
  9. Hit okay and save the edits
  10. *Go to Table Manager Plugin a. PlugingsTableTable Manager
  11. Select and delete old field
  12. Rename new field to old one.

*You will need to install Table Manager Plugin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.